- Timestamp:
- Oct 17, 2008 12:41:33 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/incdep.c
r1873 r1874 217 217 static struct alloccache incdep_dep_caches[INCDEP_MAX_THREADS]; 218 218 static struct strcache2 incdep_dep_strcaches[INCDEP_MAX_THREADS]; 219 static struct strcache2 incdep_var_strcaches[INCDEP_MAX_THREADS]; 219 220 static unsigned incdep_num_threads; 220 221 … … 316 317 incdep_free_rec (struct incdep *cur, void *rec) 317 318 { 318 alloccache_free (&incdep_rec_caches[cur->worker_tid], rec);319 /*alloccache_free (&incdep_rec_caches[cur->worker_tid], rec); - doesn't work of course. */ 319 320 } 320 321 … … 506 507 507 508 incdep_xfree (cur, cur->file_base); 509 cur->next = NULL; 508 510 free (cur); 509 511 } … … 677 679 0); /* thread safe */ 678 680 681 strcache2_init(&incdep_var_strcaches[i], 682 "incdep var", /* name */ 683 32768, /* hash size */ 684 0, /* default segment size*/ 685 0, /* case insensitive */ 686 0); /* thread safe */ 687 679 688 /* create the thread. */ 680 689 #ifdef HAVE_PTHREAD … … 742 751 alloccache_join (&dep_cache, &incdep_dep_caches[i]); 743 752 strcache2_term (&incdep_dep_strcaches[i]); 753 strcache2_term (&incdep_var_strcaches[i]); 744 754 } 745 755 incdep_num_threads = 0; … … 869 879 } 870 880 871 /* Record / execute a strcache add. */881 /* Dependency or file strcache allocation / recording. */ 872 882 static const char * 873 incdep_ record_strcache (struct incdep *cur, const char *str, int len)883 incdep_dep_strcache (struct incdep *cur, const char *str, int len) 874 884 { 875 885 const char *ret; … … 889 899 ret = strcache2_add (&incdep_dep_strcaches[cur->worker_tid], str, len); 890 900 ret = (const char *)strcache2_get_entry(&incdep_dep_strcaches[cur->worker_tid], ret); 901 } 902 return ret; 903 } 904 905 /* Variable name allocation / recording. */ 906 static const char * 907 incdep_var_strcache (struct incdep *cur, const char *str, int len) 908 { 909 const char *ret; 910 if (cur->worker_tid == -1) 911 { 912 /* XXX: we're leaking this memory now! This will be fixed later. */ 913 ret = xmalloc (len + 1); 914 memcpy ((char *)ret, str, len); 915 ((char *)ret)[len] = '\0'; 916 } 917 else 918 { 919 /* Add it out the strcache of the thread. */ 920 ret = strcache2_add (&incdep_var_strcaches[cur->worker_tid], str, len); 921 ret = (const char *)strcache2_get_entry(&incdep_var_strcaches[cur->worker_tid], ret); 891 922 } 892 923 return ret; … … 1112 1143 break; 1113 1144 } 1114 var = incdep_ record_strcache (curdep, cur, var_len);1145 var = incdep_var_strcache (curdep, cur, var_len); 1115 1146 1116 1147 /* find the end of the variable. */ … … 1270 1301 break; 1271 1302 } 1272 var = incdep_ record_strcache (curdep, cur, var_len);1303 var = incdep_var_strcache (curdep, cur, var_len); 1273 1304 1274 1305 /* find the start of the value. */ … … 1386 1417 break; 1387 1418 } 1388 filename = incdep_ record_strcache (curdep, cur, endp - cur);1419 filename = incdep_dep_strcache (curdep, cur, endp - cur); 1389 1420 1390 1421 /* parse any dependencies. */ … … 1425 1456 /* add it to the list. */ 1426 1457 *nextdep = dep = incdep_alloc_dep (curdep); 1427 dep->name = incdep_ record_strcache (curdep, cur, endp - cur);1458 dep->name = incdep_dep_strcache (curdep, cur, endp - cur); 1428 1459 dep->includedep = 1; 1429 1460 nextdep = &dep->next;
Note:
See TracChangeset
for help on using the changeset viewer.