[BACK]Return to targ.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/targ.c between version 1.56 and 1.57

version 1.56, 2008/01/29 22:23:10 version 1.57, 2008/11/04 07:22:36
Line 121 
Line 121 
 #include <stdlib.h>  #include <stdlib.h>
 #endif  #endif
   
 static struct ohash targets;    /* a hash table of same */  static struct ohash targets;    /* hash table of targets */
 struct ohash_info gnode_info = {  struct ohash_info gnode_info = {
         offsetof(GNode, name), NULL, hash_alloc, hash_free, element_alloc          offsetof(GNode, name), NULL, hash_alloc, hash_free, element_alloc
 };  };
Line 198 
Line 198 
         Lst_Init(&gn->commands);          Lst_Init(&gn->commands);
         Lst_Init(&gn->expanded);          Lst_Init(&gn->expanded);
         gn->suffix = NULL;          gn->suffix = NULL;
           gn->next = NULL;
           gn->basename = NULL;
           gn->sibling = gn;
           gn->build_lock = false;
   
 #ifdef STATS_GN_CREATION  #ifdef STATS_GN_CREATION
         STAT_GN_COUNT++;          STAT_GN_COUNT++;
Line 453 
Line 457 
         Suff_PrintAll();          Suff_PrintAll();
 }  }
   
 static char *curdir, *objdir;  struct ohash *
 static size_t curdir_len, objdir_len;  targets_hash()
   
 void  
 Targ_setdirs(const char *c, const char *o)  
 {  {
         curdir_len = strlen(c);          return &targets;
         curdir = emalloc(curdir_len+2);  
         memcpy(curdir, c, curdir_len);  
         curdir[curdir_len++] = '/';  
         curdir[curdir_len] = 0;  
   
         objdir_len = strlen(o);  
         objdir = emalloc(objdir_len+2);  
         memcpy(objdir, o, objdir_len);  
         objdir[objdir_len++] = '/';  
         objdir[objdir_len] = 0;  
 }  
   
 void  
 look_harder_for_target(GNode *gn)  
 {  
         GNode *extra, *cgn;  
         LstNode ln;  
   
         if (gn->type & (OP_RESOLVED|OP_PHONY))  
                 return;  
         gn->type |= OP_RESOLVED;  
         if (strncmp(gn->name, objdir, objdir_len) == 0) {  
                 extra = Targ_FindNode(gn->name + objdir_len, TARG_NOCREATE);  
                 if (extra != NULL) {  
                         if (Lst_IsEmpty(&gn->commands))  
                                 Lst_Concat(&gn->commands, &extra->commands);  
                         for (ln = Lst_First(&extra->children); ln != NULL;  
                             ln = Lst_Adv(ln)) {  
                                 cgn = (GNode *)Lst_Datum(ln);  
   
                                 if (Lst_AddNew(&gn->children, cgn)) {  
                                         Lst_AtEnd(&cgn->parents, gn);  
                                         gn->unmade++;  
                                 }  
                         }  
                 }  
         }  
 }  }

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57