2015-12-22
2015-12-22 17:26:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
3ebcf26569d7db45626f51f8424dc5d05cd7d88e
(29 lines)
(+24/-5)
[
Show
| Annotate
]
Branch: 8.1
Partial revert "Strings: Speeded up safe_debug_findstring() a factor htable_size."
The function is also used from the gc with pointers that not necessarily
are strings...
This reverts commit 2f782f51a5b5805f3b996a197689cf0d09508021, and
renames the new implementation under to debug_find_shared_string().
Note that this reinstates the performance issue (temporarily).
1390: Inside #if defined(PIKE_DEBUG)
Pike_fatal("Num strings is wrong %d!=%d\n",num,num_strings);
}
- int safe_debug_findstring(const struct pike_string *foo)
+ const struct pike_string *debug_find_shared_string(const struct pike_string *s)
{
size_t h;
struct pike_string *p;
- if(!base_table) return 0;
- h = HMODULO(foo->hval);
+ if(!base_table) return NULL;
+ h = HMODULO(s->hval);
for(p=base_table[h];p;p=p->next)
{
-
+ if(p==s)
+ {
+ return s;
+ }
+ }
+ return NULL;
+ }
+
+ int safe_debug_findstring(const struct pike_string *foo)
+ {
+ unsigned INT32 e;
+ if(!base_table) return 0;
+ for(e=0;e<htable_size;e++)
+ {
+ struct pike_string *p;
+ for(p=base_table[e];p;p=p->next)
+ {
if(p==foo)
{
return 1;
}
}
-
+ }
return 0;
}