Changeset 1997 for trunk/src/kmk/variable.c
- Timestamp:
- Oct 29, 2008, 10:31:35 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/variable.c
r1993 r1997 260 260 free (v->value); 261 261 v->rdonly_val = duplicate_value == -1; 262 v->value = (char *) value;262 v->value = (char *) value; 263 263 v->value_alloc_len = 0; 264 264 # else 265 265 if (v->value != 0) 266 266 free (v->value); 267 v->value = (char *) value;267 v->value = (char *) value; 268 268 v->value_alloc_len = value_len + 1; 269 269 # endif … … 271 271 else 272 272 { 273 if ( (unsigned int)v->value_alloc_len <= value_len)273 if (v->value_alloc_len <= value_len) 274 274 { 275 275 # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE … … 279 279 # endif 280 280 free (v->value); 281 v->value_alloc_len = (value_len + 0x40) & ~0x3f;281 v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (value_len + 1); 282 282 v->value = xmalloc (v->value_alloc_len); 283 283 } … … 333 333 v->rdonly_val = 0; 334 334 # endif 335 v->value_alloc_len = (value_len + 32) & ~31;335 v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (value_len + 1); 336 336 v->value = xmalloc (v->value_alloc_len); 337 337 memcpy (v->value, value, value_len + 1); 338 338 } 339 #else 339 #else /* !CONFIG_WITH_VALUE_LENGTH */ 340 340 v->value = xstrdup (value); 341 #endif 341 #endif /* !CONFIG_WITH_VALUE_LENGTH */ 342 342 if (flocp != 0) 343 343 v->fileinfo = *flocp; … … 1632 1632 1633 1633 /* adjust the size. */ 1634 if ( (unsigned)v->value_alloc_len <= new_value_len + 1)1634 if (v->value_alloc_len <= new_value_len + 1) 1635 1635 { 1636 1636 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); 1639 1639 # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE 1640 1640 if ((append || !v->value_length) && !v->rdonly_val) … … 2188 2188 v->value = p; 2189 2189 #ifdef CONFIG_WITH_VALUE_LENGTH 2190 v->value_alloc_len = -1;2190 v->value_alloc_len = ~(unsigned int)0; 2191 2191 v->value_length = eos != NULL ? eos - p : -1; 2192 2192 assert (eos == NULL || strchr (p, '\0') == eos);
Note:
See TracChangeset
for help on using the changeset viewer.