Changeset 1877 in kBuild for trunk/src/kmk
- Timestamp:
- Oct 17, 2008 1:29:35 AM (16 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/variable.c
r1864 r1877 603 603 = { 0, &global_variable_set }; 604 604 struct variable_set_list *current_variable_set_list = &global_setlist; 605 #ifdef CONFIG_WITH_STRCACHE2 606 static struct strcache2 variable_strcache; 607 #endif 605 608 606 609 … … 612 615 hash_init (&global_variable_set.table, VARIABLE_BUCKETS, 613 616 variable_hash_1, variable_hash_2, variable_hash_cmp); 617 #ifdef CONFIG_WITH_STRCACHE2 618 strcache2_init (&variable_strcache, "variable", 65536, 0, 0, 0); 619 #endif 614 620 } 615 621 … … 712 718 v = alloccache_alloc (&variable_cache); 713 719 #endif 720 #ifndef CONFIG_WITH_STRCACHE2 714 721 v->name = savestring (name, length); 722 #else 723 v->name = strcache2_add (&variable_strcache, name, length); 724 #endif 715 725 v->length = length; 716 726 #ifdef VARIABLE_HASH /* bird */ … … 1157 1167 { 1158 1168 struct variable *v = (struct variable *) item; 1169 #ifndef CONFIG_WITH_STRCACHE2 1159 1170 free (v->name); 1171 #endif 1160 1172 free (v->value); 1161 1173 } … … 1695 1707 struct variable *gv; 1696 1708 1709 #ifndef CONFIG_WITH_VALUE_LENGTH 1697 1710 gv = lookup_variable_in_set (v->name, strlen(v->name), 1698 1711 &global_variable_set); 1712 #else 1713 assert ((int)strlen(v->name) == v->length); 1714 gv = lookup_variable_in_set (v->name, v->length, 1715 &global_variable_set); 1716 #endif 1699 1717 if (gv) 1700 1718 v->export = gv->export; … … 2516 2534 printf (_("\n# %u pattern-specific variable values"), rules); 2517 2535 } 2536 2537 #ifdef CONFIG_WITH_STRCACHE2 2538 strcache2_print_stats (&variable_strcache, "# "); 2539 #endif 2518 2540 } 2519 2541 -
trunk/src/kmk/variable.h
r1847 r1877 57 57 struct variable 58 58 { 59 #ifndef CONFIG_WITH_STRCACHE2 59 60 char *name; /* Variable name. */ 61 #else 62 const char *name; /* Variable name. */ 63 #endif 60 64 int length; /* strlen (name) */ 61 65 #ifdef VARIABLE_HASH /* bird */
Note:
See TracChangeset
for help on using the changeset viewer.