Changeset 1863 for trunk/src/kmk/read.c
- Timestamp:
- Oct 14, 2008, 11:46:23 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/read.c
r1862 r1863 1017 1017 /* Parse the list of file names. */ 1018 1018 p2 = p; 1019 #ifndef CONFIG_WITH_ALLOC_CACHES 1019 1020 files = multi_glob (parse_file_seq (&p2, '\0', 1020 1021 sizeof (struct nameseq), 1021 1022 1), 1022 1023 sizeof (struct nameseq)); 1024 #else 1025 files = multi_glob (parse_file_seq (&p2, '\0', &nameseq_cache, 1), 1026 &nameseq_cache); 1027 #endif 1023 1028 free (p); 1024 1029 … … 1038 1043 int r; 1039 1044 1045 #ifndef CONFIG_WITH_ALLOC_CACHES 1040 1046 free (files); 1047 #else 1048 alloccache_free (&nameseq_cache, files); 1049 #endif 1041 1050 files = next; 1042 1051 … … 1251 1260 looking for targets. */ 1252 1261 *colonp = '\0'; 1262 #ifndef CONFIG_WITH_ALLOC_CACHES 1253 1263 filenames = multi_glob (parse_file_seq (&p2, '\0', 1254 1264 sizeof (struct nameseq), 1255 1265 1), 1256 1266 sizeof (struct nameseq)); 1267 #else 1268 filenames = multi_glob (parse_file_seq (&p2, '\0', &nameseq_cache, 1), 1269 &nameseq_cache); 1270 #endif 1257 1271 *p2 = ':'; 1258 1272 … … 1406 1420 { 1407 1421 struct nameseq *target; 1422 #ifndef CONFIG_WITH_ALLOC_CACHES 1408 1423 target = parse_file_seq (&p2, ':', sizeof (struct nameseq), 1); 1424 #else 1425 target = parse_file_seq (&p2, ':', &nameseq_cache, 1); 1426 #endif 1409 1427 ++p2; 1410 1428 if (target == 0) … … 1416 1434 if (pattern_percent == 0) 1417 1435 fatal (fstart, _("target pattern contains no `%%' (target `%s')"), target->name); /* bird */ 1436 #ifndef CONFIG_WITH_ALLOC_CACHES 1418 1437 free (target); 1438 #else 1439 alloccache_free (&nameseq_cache, target); 1440 #endif 1419 1441 } 1420 1442 else … … 2424 2446 2425 2447 nextf = filenames->next; 2448 #ifndef CONFIG_WITH_ALLOC_CACHES 2426 2449 free (filenames); 2450 #else 2451 alloccache_free (&nameseq_cache, filenames); 2452 #endif 2427 2453 2428 2454 /* Check for special targets. Do it here instead of, say, snap_deps() … … 2959 2985 If STRIP is nonzero, strip `./'s off the beginning. */ 2960 2986 2987 #ifndef CONFIG_WITH_ALLOC_CACHES 2961 2988 struct nameseq * 2962 2989 parse_file_seq (char **stringp, int stopchar, unsigned int size, int strip) 2990 #else 2991 struct nameseq * 2992 parse_file_seq (char **stringp, int stopchar, struct alloccache *cache, int strip) 2993 #endif 2963 2994 { 2964 2995 struct nameseq *new = 0; … … 3079 3110 3080 3111 /* Add it to the front of the chain. */ 3081 #if !defined(KMK) || !defined(NO_ARCHIVES)3112 #ifndef CONFIG_WITH_ALLOC_CACHES 3082 3113 new1 = xmalloc (size); 3083 3114 #else 3084 if (sizeof (struct dep) == size) /* use the cache */ 3085 new1 = (struct nameseq *)alloc_dep (); 3086 else 3087 new1 = xmalloc (size); 3115 new1 = (struct nameseq *)alloccache_alloc (cache); 3088 3116 #endif 3089 3117 new1->name = name; … … 3138 3166 Edit it out of the chain and free its storage. */ 3139 3167 lastn->next = n->next; 3168 #ifndef CONFIG_WITH_ALLOC_CACHES 3140 3169 free (n); 3170 #else 3171 alloccache_free (cache, n); 3172 #endif 3141 3173 /* LASTN->next is the new stopping elt for the loop below. */ 3142 3174 n = lastn->next; … … 3158 3190 lastn = new1; 3159 3191 new1 = new1->next; 3192 #ifndef CONFIG_WITH_ALLOC_CACHES 3160 3193 free (lastn); 3194 #else 3195 alloccache_free (cache, lastn); 3196 #endif 3161 3197 } 3162 3198 else … … 3794 3830 that have room for additional info. */ 3795 3831 3832 #ifndef CONFIG_WITH_ALLOC_CACHES 3796 3833 struct nameseq * 3797 3834 multi_glob (struct nameseq *chain, unsigned int size) 3835 #else 3836 struct nameseq * 3837 multi_glob (struct nameseq *chain, struct alloccache *cache) 3838 #endif 3798 3839 { 3799 3840 void dir_setup_glob (glob_t *); … … 3896 3937 #endif /* !NO_ARCHIVES */ 3897 3938 { 3898 #if !defined(KMK) && !defined(NO_ARCHIVES)3939 #ifndef CONFIG_WITH_ALLOC_CACHES 3899 3940 struct nameseq *elt = xmalloc (size); 3900 #else3901 struct nameseq *elt = size == sizeof(struct dep)3902 ? (void *)alloc_dep() : xmalloc (size);3903 #endif3904 3941 memset (elt, '\0', size); 3942 #else 3943 struct nameseq *elt = alloccache_calloc (cache); 3944 #endif 3905 3945 elt->name = strcache_add (gl.gl_pathv[i]); 3906 3946 elt->next = new; … … 3912 3952 #endif 3913 3953 globfree (&gl); 3914 #if !defined(KMK) && !defined(NO_ARCHIVES)3954 #ifndef CONFIG_WITH_ALLOC_CACHES 3915 3955 free (old); 3916 3956 #else 3917 if (size == sizeof(struct dep)) 3918 free_dep ((struct dep *)old); 3919 else 3920 free (old); 3957 alloccache_free (cache, old); 3921 3958 #endif 3922 3959 break;
Note:
See TracChangeset
for help on using the changeset viewer.