Changeset 1864 in kBuild for trunk/src/kmk/variable.c
- Timestamp:
- Oct 15, 2008 1:00:57 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/variable.c
r1863 r1864 707 707 /* Create a new variable definition and add it to the hash table. */ 708 708 709 #ifndef CONFIG_WITH_ALLOC_CACHES 709 710 v = xmalloc (sizeof (struct variable)); 711 #else 712 v = alloccache_alloc (&variable_cache); 713 #endif 710 714 v->name = savestring (name, length); 711 715 v->length = length; … … 1016 1020 if (l == 0) 1017 1021 { 1022 #ifndef CONFIG_WITH_ALLOC_CACHES 1018 1023 l = (struct variable_set_list *) 1019 1024 xmalloc (sizeof (struct variable_set_list)); 1020 1025 l->set = xmalloc (sizeof (struct variable_set)); 1026 #else 1027 l = (struct variable_set_list *) 1028 alloccache_alloc (&variable_set_list_cache); 1029 l->set = (struct variable_set *) 1030 alloccache_alloc (&variable_set_cache); 1031 #endif 1021 1032 hash_init (&l->set->table, PERFILE_VARIABLE_BUCKETS, 1022 1033 variable_hash_1, variable_hash_2, variable_hash_cmp); … … 1121 1132 register struct variable_set *set; 1122 1133 1134 #ifndef CONFIG_WITH_ALLOC_CACHES 1123 1135 set = xmalloc (sizeof (struct variable_set)); 1136 #else 1137 set = (struct variable_set *) alloccache_alloc (&variable_set_cache); 1138 #endif 1124 1139 hash_init (&set->table, SMALL_SCOPE_VARIABLE_BUCKETS, 1125 1140 variable_hash_1, variable_hash_2, variable_hash_cmp); 1126 1141 1142 #ifndef CONFIG_WITH_ALLOC_CACHES 1127 1143 setlist = (struct variable_set_list *) 1128 1144 xmalloc (sizeof (struct variable_set_list)); 1145 #else 1146 setlist = (struct variable_set_list *) 1147 alloccache_alloc (&variable_set_list_cache); 1148 #endif 1129 1149 setlist->set = set; 1130 1150 setlist->next = current_variable_set_list; … … 1145 1165 { 1146 1166 hash_map (&list->set->table, free_variable_name_and_value); 1167 #ifndef CONFIG_WITH_ALLOC_CACHES 1147 1168 hash_free (&list->set->table, 1); 1148 1169 free (list->set); 1149 1170 free (list); 1171 #else 1172 hash_free_cached (&list->set->table, 1, &variable_cache); 1173 alloccache_free (&variable_set_cache, list->set); 1174 alloccache_free (&variable_set_list_cache, list); 1175 #endif 1150 1176 } 1151 1177 … … 1203 1229 1204 1230 /* Free the one we no longer need. */ 1231 #ifndef CONFIG_WITH_ALLOC_CACHES 1205 1232 free (setlist); 1206 1233 hash_map (&set->table, free_variable_name_and_value); 1207 1234 hash_free (&set->table, 1); 1208 1235 free (set); 1236 #else 1237 alloccache_free (&variable_set_list_cache, setlist); 1238 hash_map (&set->table, free_variable_name_and_value); 1239 hash_free_cached (&set->table, 1, &variable_cache); 1240 alloccache_free (&variable_set_cache, set); 1241 #endif 1209 1242 } 1210 1243
Note:
See TracChangeset
for help on using the changeset viewer.