Changeset 1980 for trunk/src/kmk/expand.c
- Timestamp:
- Oct 28, 2008, 12:25:49 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/expand.c
r1975 r1980 81 81 unsigned int offset = ptr - variable_buffer; 82 82 variable_buffer_length = (newlen + 100 > 2 * variable_buffer_length 83 84 83 ? newlen + 100 84 : 2 * variable_buffer_length); 85 85 variable_buffer = xrealloc (variable_buffer, variable_buffer_length); 86 86 ptr = variable_buffer + offset; … … 116 116 variable_buffer[0] = '\0'; 117 117 } 118 #else 118 #else /* CONFIG_WITH_VALUE_LENGTH */ 119 119 if (variable_buffer == 0) 120 120 { … … 123 123 variable_buffer[0] = '\0'; 124 124 } 125 #endif 125 #endif /* CONFIG_WITH_VALUE_LENGTH */ 126 126 127 127 return variable_buffer; … … 210 210 /* Expand a simple reference to variable NAME, which is LENGTH chars long. */ 211 211 212 #if defined(__GNUC__) || defined(_MSC_VER) /* bird added MSC */212 #if defined(__GNUC__) 213 213 __inline 214 #elif defined (MY_INLINE) /* bird */ 215 MY_INLINE 214 216 #endif 215 217 static char * … … 236 238 unsigned int value_len; 237 239 240 /* XXX: Inline recursively_expand_for_file() here and what it calls, try 241 make use of O directly instead wasting time on an intermediate buffer. */ 238 242 value = recursively_expand_for_file (v, NULL, &value_len); 239 243 o = variable_buffer_output (o, value, value_len); … … 760 764 #ifndef CONFIG_WITH_VALUE_LENGTH 761 765 return variable_expand_string(NULL, line, (long)-1); 762 #else 766 #else /* CONFIG_WITH_VALUE_LENGTH */ 763 767 char *s; 764 768 … … 770 774 } 771 775 return variable_expand_string_2 (NULL, line, (long)-1, &s); 772 #endif 776 #endif /* CONFIG_WITH_VALUE_LENGTH */ 773 777 } 774 778 … … 793 797 if (!end || *end == '\0') 794 798 return allocated_variable_expand (str); 799 795 800 tmp = alloca (end - str + 1); 796 801 memcpy (tmp, str, end - str); 797 802 tmp[end - str] = '\0'; 803 798 804 return allocated_variable_expand (tmp); 799 805 #else /* CONFIG_WITH_VALUE_LENGTH */ … … 844 850 { 845 851 char *result; 846 struct variable_set_list *save ;847 const struct floc * reading_file_saved;852 struct variable_set_list *savev; 853 const struct floc *savef; 848 854 long len = length == ~0U ? (long)-1 : (long)length; 849 855 char *eol; … … 856 862 else 857 863 { 858 save = current_variable_set_list;864 savev = current_variable_set_list; 859 865 current_variable_set_list = file->variables; 860 reading_file_saved = reading_file; 866 867 savef = reading_file; 861 868 if (file->cmds && file->cmds->fileinfo.filenm) 862 869 reading_file = &file->cmds->fileinfo; 863 870 else 864 871 reading_file = 0; 872 865 873 result = variable_expand_string_2 (o, line, len, &eol); 866 current_variable_set_list = save; 867 reading_file = reading_file_saved; 874 875 current_variable_set_list = savev; 876 reading_file = savef; 868 877 } 869 878 … … 1006 1015 variable_buffer = 0; 1007 1016 1008 assert ((unsigned int)v->length == strlen (v->name)); 1017 assert ((unsigned int)v->length == strlen (v->name)); /* bird */ 1009 1018 val = variable_append (v->name, strlen (v->name), current_variable_set_list); 1010 1019 variable_buffer_output (val, "", 1);
Note:
See TracChangeset
for help on using the changeset viewer.