pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:18:      #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.77 1999/11/24 13:53:44 noring Exp $"); + RCSID("$Id: stralloc.c,v 1.78 2000/02/03 19:09:13 grubba Exp $");      #define BEGIN_HASH_SIZE 997   #define MAX_AVG_LINK_LENGTH 3      /* Experimental dynamic hash length */   #ifndef HASH_PREFIX   static unsigned int HASH_PREFIX=64;   static unsigned int need_more_hash_prefix=0;   #endif   
pike.git/src/stralloc.c:581:    add_ref(s);       return s;   }      struct pike_string * debug_make_shared_binary_pcharp(const PCHARP str,int len)   {    switch(str.shift)    {    case 0: -  return make_shared_binary_string((p_wchar0 *)(str.ptr), len); +  return make_shared_binary_string((char *)(str.ptr), len);    case 1:    return make_shared_binary_string1((p_wchar1 *)(str.ptr), len);    case 2:    return make_shared_binary_string2((p_wchar2 *)(str.ptr), len);    default:    fatal("Unknown string width!\n");    }   }      struct pike_string * debug_make_shared_pcharp(const PCHARP str)
pike.git/src/stralloc.c:1181:       if(min_magnitude(c) > a->size_shift)    {    /* String must be grown */    struct pike_string *b;       switch(TWO_SIZES(min_magnitude(c),a->size_shift))    {    case TWO_SIZES(1,0):    b=begin_wide_shared_string(a->len,1); -  convert_0_to_1(STR1(b),a->str,a->len); +  convert_0_to_1(STR1(b),(p_wchar0 *)a->str,a->len);    STR1(b)[index]=c;    free_string(a);    return end_shared_string(b);       case TWO_SIZES(2,0):    b=begin_wide_shared_string(a->len,2); -  convert_0_to_2(STR2(b),a->str,a->len); +  convert_0_to_2(STR2(b),(p_wchar0 *)a->str,a->len);    STR2(b)[index]=c;    free_string(a);    return end_shared_string(b);       case TWO_SIZES(2,1):    b=begin_wide_shared_string(a->len,2);    convert_1_to_2(STR2(b),STR1(a),a->len);    STR2(b)[index]=c;    free_string(a);    return end_shared_string(b);
pike.git/src/stralloc.c:1230:    case 0:    fatal("Unshrinkable!\n");       case 1:    /* Test if we *actually* can shrink it.. */    if(find_magnitude1(STR1(a),index)) break;    if(find_magnitude1(STR1(a)+index+1,a->len-index-1))    break;       b=begin_shared_string(a->len); -  convert_1_to_0(b->str,STR1(a),a->len); +  convert_1_to_0((p_wchar0 *)b->str,STR1(a),a->len);    b->str[index]=c;    free_string(a);    return end_shared_string(b);       case 2:    /* Test if we *actually* can shrink it.. */    size=find_magnitude2(STR2(a),index);    if(size==2) break; /* nope */    tmp=find_magnitude2(STR2(a)+index+1,a->len-index-1);    if(tmp==2) break; /* nope */    size=MAXIMUM(MAXIMUM(size,tmp),min_magnitude(c));       switch(size)    {    case 0:    b=begin_shared_string(a->len); -  convert_2_to_0(b->str,STR2(a),a->len); +  convert_2_to_0((p_wchar0 *)b->str,STR2(a),a->len);    b->str[index]=c;    free_string(a);    return end_shared_string(b);       case 1:    b=begin_wide_shared_string(a->len,1); -  convert_2_to_1((unsigned INT16 *)b->str,STR2(a),a->len); +  convert_2_to_1((p_wchar1 *)b->str,STR2(a),a->len);    STR1(b)[index]=c;    free_string(a);    return end_shared_string(b);    }    }    }          /* We now know that the string has the right character size */    if(a->refs==1)
pike.git/src/stralloc.c:1370:       if(start==0 && len==s->len)    {    add_ref(s);    return s;    }       switch(s->size_shift)    {    case 0: -  return make_shared_binary_string(STR0(s)+start,len); +  return make_shared_binary_string((char *)STR0(s)+start,len);       case 1:    return make_shared_binary_string1(STR1(s)+start,len);       case 2:    return make_shared_binary_string2(STR2(s)+start,len);    }    fatal("Illegal shift size!\n");    return 0;   }
pike.git/src/stralloc.c:1629:    i=s->s->len++;    low_set_index(s->s,i,ch);   }         void string_builder_binary_strcat(struct string_builder *s, char *str, INT32 len)   {    string_build_mkspace(s,len,0);    switch(s->s->size_shift)    { -  case 0: convert_0_to_0(STR0(s->s)+s->s->len,str,len); break; -  case 1: convert_0_to_1(STR1(s->s)+s->s->len,str,len); break; -  case 2: convert_0_to_2(STR2(s->s)+s->s->len,str,len); break; +  case 0: convert_0_to_0(STR0(s->s)+s->s->len,(p_wchar0 *)str,len); break; +  case 1: convert_0_to_1(STR1(s->s)+s->s->len,(p_wchar0 *)str,len); break; +  case 2: convert_0_to_2(STR2(s->s)+s->s->len,(p_wchar0 *)str,len); break;    default:    fatal("Illegal magnitude!\n");    }    s->s->len+=len;   }         void string_builder_append(struct string_builder *s,    PCHARP from,    INT32 len)