Changeset 1867 for trunk/src/kmk


Ignore:
Timestamp:
Oct 15, 2008, 3:28:32 AM (17 years ago)
Author:
bird
Message:

kmk: commands and file allocation caches.

Location:
trunk/src/kmk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/file.c

    r1863 r1867  
    252252    return f;
    253253
     254#ifndef CONFIG_WITH_ALLOC_CACHES
    254255  new = xmalloc (sizeof (struct file));
    255256  memset (new, '\0', sizeof (struct file));
     257#else
     258  new = alloccache_calloc (&file_cache);
     259#endif
    256260  new->name = new->hname = name;
    257261  new->update_status = -1;
  • trunk/src/kmk/main.c

    r1864 r1867  
    646646#ifdef CONFIG_WITH_ALLOC_CACHES
    647647struct alloccache dep_cache;
     648struct alloccache file_cache;
     649struct alloccache commands_cache;
    648650struct alloccache nameseq_cache;
    649651struct alloccache variable_cache;
     
    655657{
    656658  alloccache_init (&dep_cache,               sizeof (struct dep),               "dep",               NULL, NULL);
     659  alloccache_init (&file_cache,              sizeof (struct file),              "file",              NULL, NULL);
     660  alloccache_init (&commands_cache,          sizeof (struct commands),          "commands",          NULL, NULL);
    657661  alloccache_init (&nameseq_cache,           sizeof (struct nameseq),           "nameseq",           NULL, NULL);
    658662  alloccache_init (&variable_cache,          sizeof (struct variable),          "variable",          NULL, NULL);
  • trunk/src/kmk/make.h

    r1864 r1867  
    573573/* the alloc caches */
    574574extern struct alloccache dep_cache;
     575extern struct alloccache file_cache;
     576extern struct alloccache commands_cache;
    575577extern struct alloccache nameseq_cache;
    576578extern struct alloccache variable_cache;
  • trunk/src/kmk/read.c

    r1863 r1867  
    22982298
    22992299      nextf = filenames->next;
     2300#ifndef CONFIG_WITH_ALLOC_CACHES
    23002301      free (filenames);
     2302#else
     2303      alloccache_free (&nameseq_cache, filenames);
     2304#endif
    23012305
    23022306      /* If it's a pattern target, then add it to the pattern-specific
     
    24292433  if (commands_idx > 0)
    24302434    {
     2435#ifndef CONFIG_WITH_ALLOC_CACHES
    24312436      cmds = xmalloc (sizeof (struct commands));
     2437#else
     2438      cmds = alloccache_alloc (&commands_cache);
     2439#endif
    24322440      cmds->fileinfo.filenm = flocp->filenm;
    24332441      cmds->fileinfo.lineno = cmds_started;
  • trunk/src/kmk/rule.c

    r1863 r1867  
    393393    {
    394394      r->terminal = terminal;
     395#ifndef CONFIG_WITH_ALLOC_CACHES
    395396      r->cmds = xmalloc (sizeof (struct commands));
     397#else
     398      r->cmds = alloccache_alloc (&commands_cache);
     399#endif
    396400      r->cmds->fileinfo.filenm = 0;
    397401      r->cmds->fileinfo.lineno = 0;
Note: See TracChangeset for help on using the changeset viewer.