pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:1278: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG      static long last_stralloc_verify=0;   extern long current_do_debug_cycle;      PMOD_EXPORT void check_string(struct pike_string *s)   {    if(current_do_debug_cycle == last_stralloc_verify)    { -  if(debug_find_shared_string(s) != s) +  if(debug_findstring(s) != s)    Pike_fatal("Shared string not shared.\n");    }else{       switch (s->size_shift) {    case 0:    break;    case 1: {    ptrdiff_t i;    p_wchar1 *str = STR1 (s);    for (i = 0; i < s->len; i++)
pike.git/src/stralloc.c:1312: Inside #if defined(PIKE_DEBUG)
   Pike_fatal ("Invalid size shift %d.\n", s->size_shift);    }    size_shift_check_done:;       if(do_hash(s) != s->hval)    {    locate_problem(wrong_hash);    Pike_fatal("Hash value changed?\n");    }    -  if(debug_find_shared_string(s) != s) +  if(debug_findstring(s) != s)    Pike_fatal("Shared string not shared.\n");       if(index_shared_string(s,s->len))    {    locate_problem(improper_zero_termination);    Pike_fatal("Shared string is not zero terminated properly.\n");    }    }   }   
pike.git/src/stralloc.c:1383: Inside #if defined(PIKE_DEBUG)
   if(s2 == s)    Pike_fatal("Shared string table is cyclic.\n");    h=0;    }    }    }    if(num != num_strings)    Pike_fatal("Num strings is wrong %d!=%d\n",num,num_strings);   }    - const struct pike_string *debug_find_shared_string(const struct pike_string *s) + /* For once, this is actually a debug function! +  * +  * This function is mostly used to check that the argument +  * is a finished string. +  */ + const struct pike_string *debug_findstring(const struct pike_string *s)   {    size_t h;    struct pike_string *p;       if(!base_table) return NULL;    h = HMODULO(s->hval);    for(p=base_table[h];p;p=p->next)    {    if(p==s)    {
pike.git/src/stralloc.c:1418: Inside #if defined(PIKE_DEBUG)
   {    if(p==foo)    {    return 1;    }    }    }    return 0;   }    - /* for once, this is actually a debug function! */ - const struct pike_string *debug_findstring(const struct pike_string *foo) - { -  return safe_debug_findstring(foo) ? foo : 0; - } -  +    PMOD_EXPORT void debug_dump_pike_string(const struct pike_string *s, INT32 max)   {    INT32 e;    fprintf(stderr,"0x%p: %ld refs, len=%ld, size_shift=%d, hval=%lux (%lx)\n",    s,    (long)s->refs,    (long)s->len,    s->size_shift,    (unsigned long)s->hval,    (unsigned long)StrHash(s->str, s->len));