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.35 1998/04/24 00:09:35 hubbe Exp $"); + RCSID("$Id: stralloc.c,v 1.36 1998/05/25 10:38:46 hubbe 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:632:    return r;    }   }      /* Modify one index in a shared string    * Not suitable for building new strings or changing multiple characters    * within a string!    */   struct pike_string *modify_shared_string(struct pike_string *a,    INT32 index, -  char c) +  int c)   {   #ifdef DEBUG    if(index<0 || index>=a->len)    fatal("Index out of range in modify_shared_string()\n");   #endif    -  if(a->str[index]==c) return a; +  if(EXTRACT_UCHAR(a->str+index)==c) return a;       if(a->refs==1)    {    if(index>=HASH_PREFIX && index<a->len-8)    {    a->str[index]=c;    return a;    }else{    unlink_pike_string(a);    a->str[index]=c;    return end_shared_string(a);    }    }else{    struct pike_string *r;    r=begin_shared_string(a->len);    MEMCPY(r->str, a->str, a->len); -  a->str[index]=c; +  r->str[index]=c;    free_string(a);    return end_shared_string(r);    }   }      /*** Add strings ***/   struct pike_string *add_shared_strings(struct pike_string *a,    struct pike_string *b)   {    INT32 size;