Ignore:
Timestamp:
May 23, 2007, 5:13:11 AM (18 years ago)
Author:
bird
Message:

Load /home/bird/src/Gnu/make/2007-05-23 into vendor/gnumake/current.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current/variable.c

    r501 r900  
    4343
    4444struct pattern_var *
    45 create_pattern_var (char *target, char *suffix)
    46 {
    47   register struct pattern_var *p
    48     = (struct pattern_var *) xmalloc (sizeof (struct pattern_var));
     45create_pattern_var (const char *target, const char *suffix)
     46{
     47  register struct pattern_var *p = xmalloc (sizeof (struct pattern_var));
    4948
    5049  if (last_pattern_var != 0)
     
    6564
    6665static struct pattern_var *
    67 lookup_pattern_var (struct pattern_var *start, char *target)
     66lookup_pattern_var (struct pattern_var *start, const char *target)
    6867{
    6968  struct pattern_var *p;
     
    7271  for (p = start ? start->next : pattern_vars; p != 0; p = p->next)
    7372    {
    74       char *stem;
     73      const char *stem;
    7574      unsigned int stemlen;
    7675
     
    163162struct variable *
    164163define_variable_in_set (const char *name, unsigned int length,
    165                         char *value, enum variable_origin origin,
     164                        const char *value, enum variable_origin origin,
    166165                        int recursive, struct variable_set *set,
    167166                        const struct floc *flocp)
     
    209208  /* Create a new variable definition and add it to the hash table.  */
    210209
    211   v = (struct variable *) xmalloc (sizeof (struct variable));
     210  v = xmalloc (sizeof (struct variable));
    212211  v->name = savestring (name, length);
    213212  v->length = length;
     
    318317              }
    319318
    320             bcopy (v->name, p, l);
     319            memcpy (p, v->name, l);
    321320            p += l;
    322321            *(p++) = ' ';
     
    445444   parent of FILE's variable set.
    446445
    447    If we're READing a makefile, don't do the pattern variable search now,
     446   If we're READING a makefile, don't do the pattern variable search now,
    448447   since the pattern variable might not have been defined yet.  */
    449448
     
    457456      l = (struct variable_set_list *)
    458457        xmalloc (sizeof (struct variable_set_list));
    459       l->set = (struct variable_set *) xmalloc (sizeof (struct variable_set));
     458      l->set = xmalloc (sizeof (struct variable_set));
    460459      hash_init (&l->set->table, PERFILE_VARIABLE_BUCKETS,
    461460                 variable_hash_1, variable_hash_2, variable_hash_cmp);
     
    553552  register struct variable_set *set;
    554553
    555   set = (struct variable_set *) xmalloc (sizeof (struct variable_set));
     554  set = xmalloc (sizeof (struct variable_set));
    556555  hash_init (&set->table, SMALL_SCOPE_VARIABLE_BUCKETS,
    557556             variable_hash_1, variable_hash_2, variable_hash_cmp);
     
    578577  hash_map (&list->set->table, free_variable_name_and_value);
    579578  hash_free (&list->set->table, 1);
    580   free ((char *) list->set);
    581   free ((char *) list);
     579  free (list->set);
     580  free (list);
    582581}
    583582
     
    635634
    636635  /* Free the one we no longer need.  */
    637   free ((char *) setlist);
     636  free (setlist);
    638637  hash_map (&set->table, free_variable_name_and_value);
    639638  hash_free (&set->table, 1);
    640   free ((char *) set);
     639  free (set);
    641640}
    642641
     
    953952  hash_delete (&table, &makelevel_key);
    954953
    955   result = result_0 = (char **) xmalloc ((table.ht_fill + 2) * sizeof (char *));
     954  result = result_0 = xmalloc ((table.ht_fill + 2) * sizeof (char *));
    956955
    957956  v_slot = (struct variable **) table.ht_vec;
     
    974973              convert_Path_to_windows32(value, ';');
    975974#endif
    976             *result++ = concat (v->name, "=", value);
     975            *result++ = xstrdup (concat (v->name, "=", value));
    977976            free (value);
    978977          }
     
    984983              convert_Path_to_windows32(v->value, ';');
    985984#endif
    986             *result++ = concat (v->name, "=", v->value);
     985            *result++ = xstrdup (concat (v->name, "=", v->value));
    987986          }
    988987      }
    989988
    990   *result = (char *) xmalloc (100);
    991   (void) sprintf (*result, "%s=%u", MAKELEVEL_NAME, makelevel + 1);
     989  *result = xmalloc (100);
     990  sprintf (*result, "%s=%u", MAKELEVEL_NAME, makelevel + 1);
    992991  *++result = 0;
    993992
     
    10031002struct variable *
    10041003do_variable_definition (const struct floc *flocp, const char *varname,
    1005                         char *value, enum variable_origin origin,
     1004                        const char *value, enum variable_origin origin,
    10061005                        enum variable_flavor flavor, int target_var)
    10071006{
    1008   char *p, *alloc_value = NULL;
     1007  const char *p;
     1008  char *alloc_value = NULL;
    10091009  struct variable *v;
    10101010  int append = 0;
     
    10711071
    10721072            unsigned int oldlen, vallen;
    1073             char *val;
     1073            const char *val;
     1074            char *tp;
    10741075
    10751076            val = value;
     
    10881089            oldlen = strlen (v->value);
    10891090            vallen = strlen (val);
    1090             p = (char *) alloca (oldlen + 1 + vallen + 1);
    1091             bcopy (v->value, p, oldlen);
    1092             p[oldlen] = ' ';
    1093             bcopy (val, &p[oldlen + 1], vallen + 1);
     1091            tp = alloca (oldlen + 1 + vallen + 1);
     1092            memcpy (tp, v->value, oldlen);
     1093            tp[oldlen] = ' ';
     1094            memcpy (&tp[oldlen + 1], val, vallen + 1);
     1095            p = tp;
    10941096          }
    10951097      }
     
    11171119
    11181120      /* See if we can find "/bin/sh.exe", "/bin/sh.com", etc.  */
    1119       if (__dosexec_find_on_path (p, (char **)0, shellpath))
     1121      if (__dosexec_find_on_path (p, NULL, shellpath))
    11201122        {
    1121           char *p;
    1122 
    1123           for (p = shellpath; *p; p++)
    1124             {
    1125               if (*p == '\\')
    1126                 *p = '/';
    1127             }
     1123          char *tp;
     1124
     1125          for (tp = shellpath; *tp; tp++)
     1126            if (*tp == '\\')
     1127              *tp = '/';
     1128
    11281129          v = define_variable_loc (varname, strlen (varname),
    11291130                                   shellpath, origin, flavor == f_recursive,
     
    11321133      else
    11331134        {
    1134           char *shellbase, *bslash;
     1135          const char *shellbase, *bslash;
    11351136          struct variable *pathv = lookup_variable ("PATH", 4);
    11361137          char *path_string;
     
    11531154          if (pathv)
    11541155            pathlen = strlen (pathv->value);
    1155           path_string = (char *)xmalloc (5 + pathlen + 2 + 1);
     1156          path_string = xmalloc (5 + pathlen + 2 + 1);
    11561157          /* On MSDOS, current directory is considered as part of $PATH.  */
    11571158          sprintf (path_string, "PATH=.;%s", pathv ? pathv->value : "");
    11581159          fake_env[0] = path_string;
    1159           fake_env[1] = (char *)0;
     1160          fake_env[1] = 0;
    11601161          if (__dosexec_find_on_path (shellbase, fake_env, shellpath))
    11611162            {
    1162               char *p;
    1163 
    1164               for (p = shellpath; *p; p++)
    1165                 {
    1166                   if (*p == '\\')
    1167                     *p = '/';
    1168                 }
     1163              char *tp;
     1164
     1165              for (tp = shellpath; *tp; tp++)
     1166                if (*tp == '\\')
     1167                  *tp = '/';
     1168
    11691169              v = define_variable_loc (varname, strlen (varname),
    11701170                                       shellpath, origin,
     
    13201320
    13211321  /* Expand the name, so "$(foo)bar = baz" works.  */
    1322   name = (char *) alloca (end - beg + 1);
    1323   bcopy (beg, name, end - beg);
     1322  name = alloca (end - beg + 1);
     1323  memcpy (name, beg, end - beg);
    13241324  name[end - beg] = '\0';
    13251325  v->name = allocated_variable_expand (name);
     
    13741374print_variable (const void *item, void *arg)
    13751375{
    1376   const struct variable *v = (struct variable *) item;
    1377   const char *prefix = (char *) arg;
     1376  const struct variable *v = item;
     1377  const char *prefix = arg;
    13781378  const char *origin;
    13791379
     
    14891489
    14901490void
    1491 print_file_variables (struct file *file)
     1491print_file_variables (const struct file *file)
    14921492{
    14931493  if (file->variables != 0)
     
    15161516   */
    15171517  convert_Path_to_windows32 (path, ';');
    1518   environ_path = concat ("PATH", "=", path);
     1518  environ_path = xstrdup (concat ("PATH", "=", path));
    15191519  putenv (environ_path);
    15201520  free (path);
Note: See TracChangeset for help on using the changeset viewer.