Ignore:
Timestamp:
May 23, 2007, 7:31:19 AM (18 years ago)
Author:
bird
Message:

Merged with the 2007-05-23 CVS. Added rsort and fixed a couple of windows build issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmakenew/commands.c

    r778 r903  
    3434#endif
    3535
    36 extern int remote_kill PARAMS ((int id, int sig));
     36int remote_kill (int id, int sig);
    3737
    3838#ifndef HAVE_UNISTD_H
    39 extern int getpid ();
     39int getpid ();
    4040#endif
    4141
     
    4646set_file_variables (struct file *file)
    4747{
    48   struct dep *d;
    49   char *at, *percent, *star, *less;
     48  const struct dep *d;
     49  const char *at, *percent, *star, *less;
    5050
    5151#ifndef NO_ARCHIVES
     
    5656    {
    5757      unsigned int len;
     58      const char *cp;
    5859      char *p;
    5960
    60       p = strchr (file->name, '(');
    61       at = (char *) alloca (p - file->name + 1);
    62       bcopy (file->name, at, p - file->name);
    63       at[p - file->name] = '\0';
    64       len = strlen (p + 1);
    65       percent = (char *) alloca (len);
    66       bcopy (p + 1, percent, len - 1);
    67       percent[len - 1] = '\0';
     61      cp = strchr (file->name, '(');
     62      p = alloca (cp - file->name + 1);
     63      memcpy (p, file->name, cp - file->name);
     64      p[cp - file->name] = '\0';
     65      at = p;
     66      len = strlen (cp + 1);
     67      p = alloca (len);
     68      memcpy (p, cp + 1, len - 1);
     69      p[len - 1] = '\0';
     70      percent = p;
    6871    }
    6972  else
     
    8083         any suffix in the .SUFFIXES list stripped off for
    8184         explicit rules.  We store this in the `stem' member.  */
    82       register struct dep *d;
    83       char *name;
     85      const char *name;
    8486      unsigned int len;
    8587
     
    9799        }
    98100
    99       for (d = enter_file (".SUFFIXES")->deps; d != 0; d = d->next)
     101      for (d = enter_file (strcache_add (".SUFFIXES"))->deps; d ; d = d->next)
    100102        {
    101103          unsigned int slen = strlen (dep_name (d));
    102104          if (len > slen && strneq (dep_name (d), name + (len - slen), slen))
    103105            {
    104               file->stem = savestring (name, len - slen);
     106              file->stem = strcache_add_len (name, len - slen);
    105107              break;
    106108            }
     
    139141  {
    140142    static char *plus_value=0, *bar_value=0, *qmark_value=0;
    141     static unsigned int qmark_max=0, plus_max=0, bar_max=0;
     143    static unsigned int plus_max=0, bar_max=0, qmark_max=0;
    142144
    143145    unsigned int qmark_len, plus_len, bar_len;
     
    166168      if (! d->ignore_mtime)
    167169        {
    168           char *c = dep_name (d);
     170          const char *c = dep_name (d);
    169171
    170172#ifndef NO_ARCHIVES
     
    178180            len = strlen (c);
    179181
    180           bcopy (c, cp, len);
     182          memcpy (cp, c, len);
    181183          cp += len;
    182184          *cp++ = FILE_LIST_SEPARATOR;
     
    217219    for (d = file->deps; d != 0; d = d->next)
    218220      {
    219         char *c = dep_name (d);
     221        const char *c = dep_name (d);
    220222
    221223#ifndef NO_ARCHIVES
     
    231233        if (d->ignore_mtime)
    232234          {
    233             bcopy (c, bp, len);
     235            memcpy (bp, c, len);
    234236            bp += len;
    235237            *bp++ = FILE_LIST_SEPARATOR;
     
    237239        else
    238240          {
    239             bcopy (c, cp, len);
     241            memcpy (cp, c, len);
    240242            cp += len;
    241243            *cp++ = FILE_LIST_SEPARATOR;
    242244            if (d->changed)
    243245              {
    244                 bcopy (c, qp, len);
     246                memcpy (qp, c, len);
    245247                qp += len;
    246248                *qp++ = FILE_LIST_SEPARATOR;
     
    271273chop_commands (struct commands *cmds)
    272274{
    273   register char *p;
     275  const char *p;
    274276  unsigned int nlines, idx;
    275277  char **lines;
     
    286288
    287289  nlines = 5;
    288   lines = (char **) xmalloc (5 * sizeof (char *));
     290  lines = xmalloc (5 * sizeof (char *));
    289291  idx = 0;
    290292  p = cmds->commands;
    291293  while (*p != '\0')
    292294    {
    293       char *end = p;
     295      const char *end = p;
    294296    find_end:;
    295297      end = strchr (end, '\n');
     
    299301        {
    300302          int backslash = 1;
    301           register char *b;
     303          const char *b;
    302304          for (b = end - 2; b >= p && *b == '\\'; --b)
    303305            backslash = !backslash;
     
    312314        {
    313315          nlines += 2;
    314           lines = (char **) xrealloc ((char *) lines,
    315                                       nlines * sizeof (char *));
     316          lines = xrealloc (lines, nlines * sizeof (char *));
    316317        }
    317318      lines[idx++] = savestring (p, end - p);
     
    324325    {
    325326      nlines = idx;
    326       lines = (char **) xrealloc ((char *) lines,
    327                                   nlines * sizeof (char *));
     327      lines = xrealloc (lines, nlines * sizeof (char *));
    328328    }
    329329
     
    332332
    333333  cmds->any_recurse = 0;
    334   cmds->lines_flags = (char *) xmalloc (nlines);
     334  cmds->lines_flags = xmalloc (nlines);
    335335  for (idx = 0; idx < nlines; ++idx)
    336336    {
     
    382382execute_file_commands (struct file *file)
    383383{
    384   register char *p;
     384  const char *p;
    385385
    386386  /* Don't go through all the preparations if
     
    474474  if (sig == SIGTERM)
    475475    {
    476       register struct child *c;
     476      struct child *c;
    477477      for (c = children; c != 0; c = c->next)
    478478        if (!c->remote)
     
    492492    )
    493493    {
    494       register struct child *c;
     494      struct child *c;
    495495
    496496      /* Remote children won't automatically get signals sent
     
    546546
    547547static void
    548 delete_target (struct file *file, char *on_behalf_of)
     548delete_target (struct file *file, const char *on_behalf_of)
    549549{
    550550  struct stat st;
     
    601601
    602602  /* Delete the target file if it changed.  */
    603   delete_target (child->file, (char *) 0);
     603  delete_target (child->file, NULL);
    604604
    605605  /* Also remove any non-precious targets listed in the `also_make' member.  */
     
    614614
    615615void
    616 print_commands (struct commands *cmds)
     616print_commands (const struct commands *cmds)
    617617{
    618   register char *s;
     618  const char *s;
    619619
    620620  fputs (_("#  commands to execute"), stdout);
     
    629629  while (*s != '\0')
    630630    {
    631       char *end;
     631      const char *end;
    632632
    633633      while (isspace ((unsigned char)*s))
Note: See TracChangeset for help on using the changeset viewer.