Ignore:
Timestamp:
Sep 23, 2007, 7:29:00 AM (18 years ago)
Author:
bird
Message:

some silly realloc optimizations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/variable.c

    r1101 r1107  
    13941394
    13951395  /* The juicy bits, append the specified value to the variable
    1396      This is a heavily exercied code path in kBuild. */
     1396     This is a heavily exercised code path in kBuild. */
    13971397  if (v->recursive)
    13981398    {
     
    14061406      if ((unsigned)v->value_alloc_len <= new_value_len)
    14071407        {
    1408           /* XXX: anticipating further appends/prepends. */
    1409           if (value_len > v->value_alloc_len)
    1410             v->value_alloc_len = (new_value_len + 0x80) + 0x7f;
    1411           else
    1412             v->value_alloc_len = (new_value_len + value_len + 0x80) + 0x7f;
     1408          v->value_alloc_len *= 2;
     1409          if (v->value_alloc_len < new_value_len)
     1410              v->value_alloc_len = (new_value_len + value_len + 0x7f) + ~0x7fU;
    14131411          if (append || !v->value_length)
    14141412            v->value = xrealloc (v->value, v->value_alloc_len);
Note: See TracChangeset for help on using the changeset viewer.