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

Diff for /src/usr.bin/make/var.c between version 1.51 and 1.52

version 1.51, 2000/12/07 00:15:43 version 1.52, 2001/03/02 16:57:26
Line 195 
Line 195 
     char          name[1];      /* the variable's name */      char          name[1];      /* the variable's name */
 }  Var;  }  Var;
   
 static struct hash_info var_info = {  static struct ohash_info var_info = {
         offsetof(Var, name),          offsetof(Var, name),
     NULL, hash_alloc, hash_free, element_alloc };      NULL, hash_alloc, hash_free, element_alloc };
 static int quick_lookup __P((const char *, const char **, u_int32_t *));  static int quick_lookup __P((const char *, const char **, u_int32_t *));
Line 238 
Line 238 
 {  {
     size_t len;      size_t len;
   
     *pk = hash_interval(name, end);      *pk = ohash_interval(name, end);
     len = *end - name;      len = *end - name;
         /* substitute short version for long local name */          /* substitute short version for long local name */
     switch (*pk % MAGICSLOTS) {             /* MAGICSLOTS should be the    */      switch (*pk % MAGICSLOTS) {             /* MAGICSLOTS should be the    */
Line 398 
Line 398 
     Var *v;      Var *v;
     const char *end = NULL;      const char *end = NULL;
   
     v = hash_create_entry(&var_info, name, &end);      v = ohash_create_entry(&var_info, name, &end);
   
     if (val != NULL) {      if (val != NULL) {
         size_t len = strlen(val);          size_t len = strlen(val);
Line 417 
Line 417 
     const char  *end;      const char  *end;
     u_int32_t   k;      u_int32_t   k;
 {  {
     return hash_find(ctxt, hash_lookup_interval(ctxt, name, end, k));      return ohash_find(ctxt, ohash_lookup_interval(ctxt, name, end, k));
 }  }
   
 /*-  /*-
Line 547 
Line 547 
         Parse_Error(PARSE_FATAL, "Trying to set dynamic variable %s",          Parse_Error(PARSE_FATAL, "Trying to set dynamic variable %s",
             v->name);              v->name);
     else      else
         hash_insert(ctxt, hash_lookup_interval(ctxt, name, end, k), v);          ohash_insert(ctxt, ohash_lookup_interval(ctxt, name, end, k), v);
     return v;      return v;
 }  }
   
Line 591 
Line 591 
     if (DEBUG(VAR))      if (DEBUG(VAR))
         printf("%s:delete %s\n", context_name(ctxt), name);          printf("%s:delete %s\n", context_name(ctxt), name);
     (void)quick_lookup(name, &end, &k);      (void)quick_lookup(name, &end, &k);
     v = hash_remove(ctxt, hash_lookup_interval(ctxt, name, end, k));      v = ohash_remove(ctxt, ohash_lookup_interval(ctxt, name, end, k));
   
     if (v != NULL)      if (v != NULL)
         VarDelete(v);          VarDelete(v);
Line 1119 
Line 1119 
     VAR_GLOBAL = &global_vars;      VAR_GLOBAL = &global_vars;
     VAR_CMD = &cmd_vars;      VAR_CMD = &cmd_vars;
     VAR_ENV = &env_vars;      VAR_ENV = &env_vars;
     hash_init(VAR_GLOBAL, 10, &var_info);      ohash_init(VAR_GLOBAL, 10, &var_info);
     hash_init(VAR_CMD, 5, &var_info);      ohash_init(VAR_CMD, 5, &var_info);
     hash_init(VAR_ENV, 5, &var_info);      ohash_init(VAR_ENV, 5, &var_info);
     CTXT_GLOBAL = (SymTable *)VAR_GLOBAL;      CTXT_GLOBAL = (SymTable *)VAR_GLOBAL;
     CTXT_CMD = (SymTable *)VAR_CMD;      CTXT_CMD = (SymTable *)VAR_CMD;
     CTXT_ENV = (SymTable *)VAR_ENV;      CTXT_ENV = (SymTable *)VAR_ENV;
Line 1135 
Line 1135 
     Var *v;      Var *v;
     unsigned int i;      unsigned int i;
   
     for (v = hash_first(VAR_GLOBAL, &i); v != NULL;      for (v = ohash_first(VAR_GLOBAL, &i); v != NULL;
         v = hash_next(VAR_GLOBAL, &i))          v = ohash_next(VAR_GLOBAL, &i))
             VarDelete(v);              VarDelete(v);
     for (v = hash_first(VAR_CMD, &i); v != NULL;      for (v = ohash_first(VAR_CMD, &i); v != NULL;
         v = hash_next(VAR_CMD, &i))          v = ohash_next(VAR_CMD, &i))
             VarDelete(v);              VarDelete(v);
     for (v = hash_first(VAR_ENV, &i); v != NULL;      for (v = ohash_first(VAR_ENV, &i); v != NULL;
         v = hash_next(VAR_ENV, &i))          v = ohash_next(VAR_ENV, &i))
             VarDelete(v);              VarDelete(v);
 #endif  #endif
 }  }
Line 1171 
Line 1171 
         Var *v;          Var *v;
         unsigned int i;          unsigned int i;
   
         for (v = hash_first(ctxt, &i); v != NULL;          for (v = ohash_first(ctxt, &i); v != NULL;
             v = hash_next(ctxt, &i))              v = ohash_next(ctxt, &i))
                 VarPrintVar(v);                  VarPrintVar(v);
 }  }
   
Line 1195 
Line 1195 
   
     Buf_Init(&buf, MAKE_BSIZE);      Buf_Init(&buf, MAKE_BSIZE);
   
     for (v = hash_first(VAR_CMD, &i); v != NULL;      for (v = ohash_first(VAR_CMD, &i); v != NULL;
         v = hash_next(VAR_CMD, &i)) {          v = ohash_next(VAR_CMD, &i)) {
                 /* We assume variable names don't need quoting */                  /* We assume variable names don't need quoting */
                 Buf_AddString(&buf, v->name);                  Buf_AddString(&buf, v->name);
                 Buf_AddChar(&buf, '=');                  Buf_AddChar(&buf, '=');

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52