pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:16:      #include <errno.h>   #include <float.h>   #include <ctype.h>   #include <math.h>      #ifndef HUGE   #define HUGE HUGE_VAL   #endif /*!HUGE*/    - RCSID("$Id: stralloc.c,v 1.57 1999/03/23 03:04:00 marcus Exp $"); + RCSID("$Id: stralloc.c,v 1.58 1999/04/01 17:20:17 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:168:    return 0;    return 1;    }   }         void generic_memcpy(PCHARP to,    PCHARP from,    int len)   { + #ifdef PIKE_DEBUG +  if(len<0) +  fatal("Cannot copy %d bytes!\n",len); + #endif +     switch(TWO_SIZES(from.shift,to.shift))    {    case TWO_SIZES(0,0):    convert_0_to_0((p_wchar0 *)to.ptr,(p_wchar0 *)from.ptr,len);    break;    case TWO_SIZES(0,1):    convert_0_to_1((p_wchar1 *)to.ptr,(p_wchar0 *)from.ptr,len);    break;    case TWO_SIZES(0,2):    convert_0_to_2((p_wchar2 *)to.ptr,(p_wchar0 *)from.ptr,len);
pike.git/src/stralloc.c:1367:    ret=begin_wide_shared_string(str->len + (to->len-del->len)*delimeters, shift);    }    s=str->str;    r=MKPCHARP_STR(ret);       while((tmp=(char *)generic_memory_search(&searcher,    s,    (end-s)>>str->size_shift,    str->size_shift)))    { + #ifdef PIKE_DEBUG +  if(tmp + (del->len << str->size_shift) > end) +  fatal("generic_memory_search found a match beyond end of string!!!\n"); + #endif    generic_memcpy(r,MKPCHARP(s,str->size_shift),(tmp-s)>>str->size_shift);    INC_PCHARP(r,(tmp-s)>>str->size_shift);    pike_string_cpy(r,to);    INC_PCHARP(r,to->len);    s=tmp+(del->len << str->size_shift);    }    generic_memcpy(r,MKPCHARP(s,str->size_shift),(end-s)>>str->size_shift);       return end_shared_string(ret);   }