Ignore:
Timestamp:
Sep 18, 2006, 1:49:49 AM (19 years ago)
Author:
bird
Message:

skip some unnecessary copies and allocations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/function.c

    r530 r531  
    886886    {
    887887      char *result = 0;
    888 
     888#ifdef CONFIG_WITH_VALUE_LENGTH
     889      if (len > (unsigned int)var->value_length)
     890        {
     891          free (var->value);
     892          var->value = xmalloc (len + 1);
     893        }
     894      memcpy (var->value, p, len);
     895      var->value[len] = '\0';
     896      var->value_length = len;
     897#else
    889898      {
    890         char save = p[len];
    891 
    892         p[len] = '\0';
    893         free (var->value);
    894         var->value = (char *) xstrdup ((char*) p);
    895         p[len] = save;
     899        char save = p[len];
     900
     901        p[len] = '\0';
     902        free (var->value);
     903        var->value = (char *) xstrdup ((char*) p);
     904        p[len] = save;
    896905      }
     906#endif
    897907
    898908      result = allocated_variable_expand (body);
Note: See TracChangeset for help on using the changeset viewer.