pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:8:   #include "pike_macros.h"   #include "dynamic_buffer.h"   #include "pike_macros.h"   #include "pike_memory.h"   #include "error.h"   #include "gc.h"   #include "stuff.h"      #include <ctype.h>    - RCSID("$Id: stralloc.c,v 1.33 1998/04/17 17:50:35 hubbe Exp $"); + RCSID("$Id: stralloc.c,v 1.34 1998/04/20 18:53:23 grubba Exp $");      #define BEGIN_HASH_SIZE 997   #define MAX_AVG_LINK_LENGTH 3   #define HASH_PREFIX 64      unsigned INT32 htable_size=0;   static unsigned int hashprimes_entry=0;   static struct pike_string **base_table=0;   static unsigned INT32 full_hash_value;   unsigned INT32 num_strings=0;
pike.git/src/stralloc.c:228:    fatal("end_shared_string called twice! (or something like that)\n");   #endif       if(s2)    {    free((char *)s);    s=s2;    }else{    link_pike_string(s, h);    } -  s->refs++; +  add_ref(s);       return s;   }      struct pike_string * debug_make_shared_binary_string(const char *str,int len)   {    struct pike_string *s;    int h=StrHash(str,len);       s = internal_findstring(str,len,h);    if (!s)    {    s=begin_shared_string(len);    MEMCPY(s->str, str, len);    link_pike_string(s, h);    }    -  s->refs++; +  add_ref(s);       return s;   }      struct pike_string *debug_make_shared_string(const char *str)   {    return make_shared_binary_string(str, strlen(str));   }      /*** Free strings ***/
pike.git/src/stralloc.c:703:   struct pike_string *string_replace(struct pike_string *str,    struct pike_string *del,    struct pike_string *to)   {    struct pike_string *ret;    char *s,*tmp,*r,*end;    struct mem_searcher searcher;       if(!str->len)    { -  str->refs++; +  add_ref(str);    return str;    }       if(!del->len)    {    int e;    ret=begin_shared_string(str->len + to->len * (str->len -1));    s=ret->str;    *(s++)=str->str[0];    for(e=1;e<str->len;e++)
pike.git/src/stralloc.c:740:    INT32 delimeters=0;    init_memsearch(&searcher, del->str, del->len, str->len*2);    while((s=memory_search(&searcher,s,end-s)))    {    delimeters++;    s+=del->len;    }       if(!delimeters)    { -  str->refs++; +  add_ref(str);    return str;    }       ret=begin_shared_string(str->len + (to->len-del->len)*delimeters);    }    s=str->str;    r=ret->str;       while((tmp=memory_search(&searcher,s,end-s)))    {