Ignore:
Timestamp:
Mar 14, 2018, 10:28:10 PM (7 years ago)
Author:
bird
Message:

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk

  • trunk/src/kmk/alloccache.c

    r2633 r3140  
    3838*   Header Files                                                               *
    3939*******************************************************************************/
    40 #include "make.h"
     40#include "makeint.h"
    4141#include "dep.h"
    4242#include "debug.h"
     
    6767  cache->free_head = f;
    6868  MAKE_STATS(cache->free_count++;);
    69 #else
    70   free(item);
    71 #endif
     69#else  /* CONFIG_WITH_ALLOCCACHE_DEBUG */
     70
     71  struct alloccache **ppcache = (struct alloccache **)item - 1;
     72  MY_ASSERT_MSG (*ppcache == cache, ("*ppcache=%p cache=%p item=%p\n", *ppcache, cache, item));
     73  *ppcache = NULL;
     74  free(ppcache);
     75#endif /* CONFIG_WITH_ALLOCCACHE_DEBUG */
    7276}
    7377
     
    99103  /* caller counts */
    100104  return (struct alloccache_free_ent *)item;
    101 #else
    102   return (struct alloccache_free_ent *)xmalloc(cache->size);
    103 #endif
     105#else  /* CONFIG_WITH_ALLOCCACHE_DEBUG */
     106
     107  /* Prefix the allocation with a cache pointer so alloccahce_free can better
     108     catch incorrect calls. */
     109  struct alloccache **ppcache = (struct alloccache **)xmalloc(sizeof(*ppcache) + cache->size);
     110  *ppcache = cache;
     111  return (struct alloccache_free_ent *)(ppcache + 1);
     112#endif /* CONFIG_WITH_ALLOCCACHE_DEBUG */
    104113}
    105114
Note: See TracChangeset for help on using the changeset viewer.