2001-03-30
2001-03-30 15:34:53 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
4bdf5f8e26d680a27ab6e32e496e517fc49bf45e
(20 lines)
(+18/-2)
[
Show
| Annotate
]
Branch: 7.9
Bugfix in internal_findstring().
Added some more debug.
Rev: src/stralloc.c:1.123
26:
#define HUGE HUGE_VAL
#endif /*!HUGE*/
- RCSID("$Id: stralloc.c,v 1.122 2001/03/30 12:23:16 hubbe Exp $");
+ RCSID("$Id: stralloc.c,v 1.123 2001/03/30 15:34:53 grubba Exp $");
#if PIKE_RUN_UNLOCKED
/* Make this bigger when we get lightweight threads */
305:
DM(dump_memhdr_locations(yes,no,0));
}
+ static int bad_pointer(struct pike_string *s)
+ {
+ return (((ptrdiff_t)s)&(sizeof(pike_string *)-1));
+ }
+
static int has_zero_refs(struct pike_string *s)
{
return s->refs<=0;
327:
static INLINE struct pike_string *internal_findstring(const char *s,
ptrdiff_t len,
int size_shift,
- ptrdiff_t hval)
+ size_t hval)
{
struct pike_string *curr,**prev, **base;
#ifndef HASH_PREFIX
880:
LOCK_BUCKET(s->hval);
h= s->hval % htable_size;
propagate_shared_string(s,h);
+ #ifdef PIKE_DEBUG
+ if (base_table[h] != s) {
+ fatal("propagate_shared_string() failed!\n");
+ }
+ #endif /* PIKE_DEBUG */
base_table[h]=s->next;
#ifdef PIKE_DEBUG
s->next=(struct pike_string *)(ptrdiff_t)-1;
1029: Inside #if defined(PIKE_DEBUG)
{
num++;
h++;
+
+ if (bad_pointer(s)) {
+ fatal("Odd string pointer in string table!\n");
+ }
+
if(s->len < 0)
fatal("Shared string shorter than zero bytes.\n");