Changeset 1931 for trunk/src/kmk/expand.c
- Timestamp:
- Oct 24, 2008, 9:02:48 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/expand.c
r1929 r1931 60 60 }; 61 61 struct recycled_buffer *recycled_head; 62 static char * 63 allocated_variable_expand_3 (const char *line, unsigned int length, 64 unsigned int *value_lenp, 65 unsigned int *buffer_lengthp); 66 static void 67 recycle_variable_buffer (char *buffer, unsigned int length); 68 69 #endif 62 #endif /* CONFIG_WITH_VALUE_LENGTH */ 70 63 71 64 … … 1071 1064 } 1072 1065 1073 /* Handles a special case for variable_expand_string2 where the variable1074 name is expanded. This variant allows the variable_buffer to1075 be recycled and thus avoid bothering with a slow free implementation1076 (darwin is horrible here).*/1077 1078 staticchar *1066 /* Initially created for handling a special case for variable_expand_string2 1067 where the variable name is expanded and freed right afterwards. This 1068 variant allows the variable_buffer to be recycled and thus avoid bothering 1069 with a slow free implementation. (Darwin is horrible slow.) */ 1070 1071 char * 1079 1072 allocated_variable_expand_3 (const char *line, unsigned int length, 1080 1073 unsigned int *value_lenp, … … 1090 1083 1091 1084 value = variable_expand_string_2 (NULL, line, len, &eol); 1092 *value_lenp = eol - value; 1085 if (value_lenp) 1086 *value_lenp = eol - value; 1093 1087 *buffer_lengthp = variable_buffer_length; 1094 1088 … … 1100 1094 1101 1095 /* recycle a buffer. */ 1102 static void 1096 1097 void 1103 1098 recycle_variable_buffer (char *buffer, unsigned int length) 1104 1099 { … … 1133 1128 restore_variable_buffer (char *buf, unsigned int len) 1134 1129 { 1130 #ifndef CONFIG_WITH_VALUE_LENGTH 1135 1131 free (variable_buffer); 1132 #else 1133 if (variable_buffer) 1134 recycle_variable_buffer (variable_buffer, variable_buffer_length); 1135 #endif 1136 1136 1137 1137 variable_buffer = buf;
Note:
See TracChangeset
for help on using the changeset viewer.