pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:20:      #include <errno.h>   #include <float.h>   #include <ctype.h>   #include <math.h>      #ifndef HUGE   #define HUGE HUGE_VAL   #endif /*!HUGE*/    - RCSID("$Id: stralloc.c,v 1.132 2001/09/04 19:26:54 mast Exp $"); + RCSID("$Id: stralloc.c,v 1.133 2001/09/05 01:42:47 hubbe Exp $");      #if PIKE_RUN_UNLOCKED   /* Make this bigger when we get lightweight threads */   #define BUCKET_LOCKS 2048   static PIKE_MUTEX_T *bucket_locks;      #define BUCKETLOCK(HVAL) \    (bucket_locks + ((hval__ % htable_size) & (BUCKET_LOCKS-1)))      #define LOCK_BUCKET(HVAL) do { \
pike.git/src/stralloc.c:996:    sprintf(b,"Searches: %ld Average search length: %6.3f\n",    (long)num_str_searches, (double)search_len / num_str_searches);    my_strcat(b);   */    return free_buf();   }      /*** 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_findstring(s) !=s) +  fatal("Shared string not shared.\n"); +  }else{    if(do_hash(s) != s->hval)    {    locate_problem(wrong_hash);    fatal("Hash value changed?\n");    }       if(debug_findstring(s) !=s)    fatal("Shared string not shared.\n");       if(index_shared_string(s,s->len))    {    locate_problem(improper_zero_termination);    fatal("Shared string is not zero terminated properly.\n");    }    } -  + }      PMOD_EXPORT void verify_shared_strings_tables(void)   {    unsigned INT32 e, h, num=0;    struct pike_string *s;    -  +  last_stralloc_verify=current_do_debug_cycle; +     for(e=0;e<htable_size;e++)    {    h=0;    LOCK_BUCKET(e);    for(s=base_table[e];s;s=s->next)    {    num++;    h++;       if (bad_pointer(s)) {