pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:133: Inside #if defined(DEBUG)
   if(curr->refs<1)    fatal("String with no references.\n");   #endif    }    return 0; /* not found */   }      #ifdef DEBUG   struct pike_string *debug_findstring(const struct pike_string *foo)   { -  return propagate_shared_string(foo, foo->hval % HTABLE_SIZE); +  struct pike_string *tmp; +  tmp=propagate_shared_string(foo, foo->hval % HTABLE_SIZE); +  + #if 0 +  if(!tmp) +  { +  int e; +  struct pike_string *tmp2; +  fprintf(stderr,"String %p %ld %ld %s\n", +  foo, +  (long)foo->hval, +  (long)foo->len, +  foo->str); +  StrHash(foo->str,foo->len); +  fprintf(stderr,"------ %p %ld\n", +  base_table[foo->hval %HTABLE_SIZE], +  (long)full_hash_value); +  for(tmp2=base_table[foo->hval % HTABLE_SIZE];tmp2;tmp2=tmp2->next) +  { +  if(tmp2 == tmp) +  fprintf(stderr,"!!%p!!->",tmp2); +  else +  fprintf(stderr,"%p->",tmp2);    } -  +  fprintf(stderr,"0\n"); +  +  for(e=0;e<HTABLE_SIZE;e++) +  { +  for(tmp2=base_table[e];tmp2;tmp2=tmp2->next) +  { +  if(tmp2 == tmp) +  fprintf(stderr,"String found in hashbin %ld (not %ld)\n", +  (long)e, +  (long)(foo->hval % HTABLE_SIZE)); +  } +  } +  }   #endif -  +  return tmp; + } + #endif      /* note that begin_shared_string expects the _exact_ size of the string,    * not the maximum size    */   struct pike_string *begin_shared_string(int len)   {    struct pike_string *t;    t=(struct pike_string *)xalloc(len + sizeof(struct pike_string));    t->str[len]=0;    t->len=len;