Ignore:
Timestamp:
Oct 29, 2008, 10:31:35 PM (17 years ago)
Author:
bird
Message:

variaiable::value_alloc_len -> unsigned int.

File:
1 edited

Legend:

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

    r1993 r1997  
    260260                  free (v->value);
    261261              v->rdonly_val = duplicate_value == -1;
    262               v->value = (char *)value;
     262              v->value = (char *) value;
    263263              v->value_alloc_len = 0;
    264264# else
    265265              if (v->value != 0)
    266266                free (v->value);
    267               v->value = (char *)value;
     267              v->value = (char *) value;
    268268              v->value_alloc_len = value_len + 1;
    269269# endif
     
    271271          else
    272272            {
    273               if ((unsigned int)v->value_alloc_len <= value_len)
     273              if (v->value_alloc_len <= value_len)
    274274                {
    275275# ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE
     
    279279# endif
    280280                    free (v->value);
    281                   v->value_alloc_len = (value_len + 0x40) & ~0x3f;
     281                  v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (value_len + 1);
    282282                  v->value = xmalloc (v->value_alloc_len);
    283283                }
     
    333333      v->rdonly_val = 0;
    334334# endif
    335       v->value_alloc_len = (value_len + 32) & ~31;
     335      v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (value_len + 1);
    336336      v->value = xmalloc (v->value_alloc_len);
    337337      memcpy (v->value, value, value_len + 1);
    338338    }
    339 #else
     339#else  /* !CONFIG_WITH_VALUE_LENGTH */
    340340  v->value = xstrdup (value);
    341 #endif
     341#endif /* !CONFIG_WITH_VALUE_LENGTH */
    342342  if (flocp != 0)
    343343    v->fileinfo = *flocp;
     
    16321632
    16331633  /* adjust the size. */
    1634   if ((unsigned)v->value_alloc_len <= new_value_len + 1)
     1634  if (v->value_alloc_len <= new_value_len + 1)
    16351635    {
    16361636      v->value_alloc_len *= 2;
    1637       if ((unsigned)v->value_alloc_len < new_value_len + 1)
    1638           v->value_alloc_len = (new_value_len + 1 + value_len + 0x7f) + ~0x7fU;
     1637      if (v->value_alloc_len < new_value_len + 1)
     1638          v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (new_value_len + 1 + value_len + 1);
    16391639# ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE
    16401640      if ((append || !v->value_length) && !v->rdonly_val)
     
    21882188  v->value = p;
    21892189#ifdef CONFIG_WITH_VALUE_LENGTH
    2190   v->value_alloc_len = -1;
     2190  v->value_alloc_len = ~(unsigned int)0;
    21912191  v->value_length = eos != NULL ? eos - p : -1;
    21922192  assert (eos == NULL || strchr (p, '\0') == eos);
Note: See TracChangeset for help on using the changeset viewer.