Changeset 1607 in kBuild
- Timestamp:
- May 8, 2008 2:58:55 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/expand.c
r1606 r1607 611 611 append_expanded_string_to_variable (struct variable *v, const char *value) 612 612 { 613 #if 0 /* This isn't safe because the v->value will become invalid if the 614 variable buffer is reallocated to a new address. Sad but true. */ 613 615 static char const empty_string[] = ""; 614 616 unsigned int original_value_length = v->value_length; … … 662 664 variable_buffer = saved_buffer; 663 665 variable_buffer_length = saved_buffer_length; 666 #else 667 char *p; 668 669 /* Install a fresh variable buffer. */ 670 char *saved_buffer; 671 unsigned int saved_buffer_length; 672 install_variable_buffer (&saved_buffer, saved_buffer_length); 673 674 /* Copy the current value into it and append a space. */ 675 if (v->value_length) 676 { 677 p = variable_buffer_output (variable_buffer, v->value, v->value_length); 678 p = variable_buffer_output (p, " ", 1); 679 } 680 681 /* Append the assignment value. */ 682 p = variable_expand_string (p, value, (long)-1); 683 p = strchr (p, '\0'); 684 685 /* Replace the variable with the variable buffer. */ 686 free (v->value); 687 v->value = variable_buffer; 688 v->value_length = p - v->value; 689 v->value_alloc_len = variable_buffer_length; 690 691 /* Restore the variable buffer, but without freeing the current. */ 692 variable_buffer = NULL; 693 restore_variable_buffer (saved_buffer, saved_buffer_length); 694 #endif 664 695 } 665 696 #endif /* CONFIG_WITH_VALUE_LENGTH */
Note:
See TracChangeset
for help on using the changeset viewer.