pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: stralloc.c,v 1.198 2005/04/02 15:04:03 mast Exp $ + || $Id: stralloc.c,v 1.199 2005/05/17 21:44:30 grubba Exp $   */      #include "global.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "dynamic_buffer.h"   #include "pike_macros.h"   #include "pike_memory.h"   #include "pike_error.h"   #include "gc.h"
pike.git/src/stralloc.c:1644:    /* We now know that the string has the right character size */    if(a->refs==1)    {    /* One ref - destructive mode */       unlink_pike_string(a);    low_set_index(a, index, c);    if((((unsigned int)index) >= HASH_PREFIX) && (index < a->len-8))    {    struct pike_string *old; +  if (wrong_hash(a)) { +  Pike_fatal("Broken hash optimization.\n"); +  }    /* Doesn't change hash value - sneak it in there */    old = internal_findstring(a->str, a->len, a->size_shift, a->hval);    if (old) {    /* The new string is equal to some old string. */    really_free_pike_string(a);    add_ref(a = old);    } else {    link_pike_string(a, a->hval); -  +  add_ref(a);    }    }else{    a = end_shared_string(a);    }    return a;    }else{    struct pike_string *r;    r=begin_wide_shared_string(a->len,a->size_shift);    MEMCPY(r->str, a->str, a->len << a->size_shift);    low_set_index(r,index,c);