pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:18:    */   static unsigned int StrHash(const char *s,int len)   {    full_hash_value=hashmem((unsigned char *)s, len, 20);    return full_hash_value % HTABLE_SIZE;   }      #ifdef DEBUG   void check_string(struct lpc_string *s)   { +  StrHash(s->str, s->len); +  if(full_hash_value != s->hval) +  fatal("Hash value changed?\n"); +     if(debug_findstring(s) !=s)    fatal("Shared string not shared.\n");       if(s->str[s->len])    fatal("Shared string is not zero terminated properly.\n");   }      void verify_shared_strings_tables()   {    unsigned int e, h;
pike.git/src/stralloc.c:126: Inside #if defined(DEBUG)
   if(curr->refs<1)    fatal("String with no references.\n");   #endif    }    return 0; /* not found */   }      #ifdef DEBUG   struct lpc_string *debug_findstring(const struct lpc_string *foo)   { -  return propagate_shared_string(foo, StrHash(foo->str, foo->len)); +  return propagate_shared_string(foo, foo->hval % HTABLE_SIZE);   }   #endif      /* note that begin_shared_string expects the _exact_ size of the string,    * not the maximum size    */   struct lpc_string *begin_shared_string(int len)   {    struct lpc_string *t;    t=(struct lpc_string *)xalloc(len + sizeof(struct lpc_string));