pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:936:      PMOD_EXPORT struct pike_string * debug_make_shared_binary_string(const char *str,size_t len)   {    struct pike_string *s;    ptrdiff_t h = StrHash(str, len);       s = internal_findstring(str,len,0,h);    if (!s)    {    s=begin_shared_string(len); -  MEMCPY(s->str, str, len); +  memcpy(s->str, str, len);    link_pike_string(s, h);    } else {    add_ref(s);    }       return s;   }      PMOD_EXPORT struct pike_string * debug_make_shared_binary_pcharp(const PCHARP str,size_t len)   {
pike.git/src/stralloc.c:993:    convert_1_to_0(STR0(s),str,len);    return end_shared_string(s);    }       h=low_do_hash(str, len, 1);       s = internal_findstring((char *)str,len,1,h);    if (!s)    {    s=begin_wide_shared_string(len,1); -  MEMCPY(s->str, str, len<<1); +  memcpy(s->str, str, len<<1);    link_pike_string(s, h);    } else {    add_ref(s);    }       return s;   }      PMOD_EXPORT struct pike_string * debug_make_shared_binary_string2(const p_wchar2 *str,size_t len)   {
pike.git/src/stralloc.c:1028:    convert_2_to_1(STR1(s),str,len);    return end_shared_string(s); /* not entirely optimal */    }       h=low_do_hash(str, len, 2);       s = internal_findstring((char *)str,len,2,h);    if (!s)    {    s=begin_wide_shared_string(len,2); -  MEMCPY(s->str, str, len<<2); +  memcpy(s->str, str, len<<2);    link_pike_string(s, h);    } else {    add_ref(s);    }       return s;   }      PMOD_EXPORT struct pike_string *debug_make_shared_string(const char *str)   {
pike.git/src/stralloc.c:1691:    r=realloc(a, sizeof(struct pike_string_hdr)+((size+1)<<a->size_shift));    }       if(!r)    {    r=begin_wide_shared_string(size, a->size_shift);    r->flags |= a->flags & ~15;    r->min = a->min;    r->max = a->max;    if (a->len <= size) { -  MEMCPY(r->str, a->str, a->len<<a->size_shift); +  memcpy(r->str, a->str, a->len<<a->size_shift);    } else { -  MEMCPY(r->str, a->str, size<<a->size_shift); +  memcpy(r->str, a->str, size<<a->size_shift);    }    free_string(a);    }       r->len=size;    low_set_index(r,size,0);    return r;   }      /* Returns an unlinked string ready for end_shared_string */   static struct pike_string *realloc_shared_string(struct pike_string *a,    ptrdiff_t size)   {    struct pike_string *r;    if(a->refs==1)    {    unlink_pike_string(a);    return realloc_unlinked_string(a, size);    }else{    r=begin_wide_shared_string(size,a->size_shift); -  MEMCPY(r->str, a->str, a->len<<a->size_shift); +  memcpy(r->str, a->str, a->len<<a->size_shift);    r->flags |= a->flags & ~15;    r->min = a->min;    r->max = a->max;    free_string(a);    return r;    }   }      struct pike_string *new_realloc_shared_string(struct pike_string *a, INT32 size, int shift)   {
pike.git/src/stralloc.c:1889:    } else {    link_pike_string(a, a->hval);    }    }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); +  memcpy(r->str, a->str, a->len << a->size_shift);    low_set_index(r,index,c);    free_string(a);    return end_shared_string(r);    }   }      PMOD_EXPORT void set_flags_for_add( struct pike_string *ret,    unsigned char aflags,    unsigned char amin,    unsigned char amax,
pike.git/src/stralloc.c:1963:   }      PMOD_EXPORT struct pike_string *add_and_free_shared_strings(struct pike_string *a,    struct pike_string *b)   {    ptrdiff_t alen = a->len;    if(a->size_shift == b->size_shift)    {    a = realloc_shared_string(a, alen + b->len);    update_flags_for_add( a, b ); -  MEMCPY(a->str+(alen<<a->size_shift),b->str,b->len<<b->size_shift); +  memcpy(a->str+(alen<<a->size_shift),b->str,b->len<<b->size_shift);    free_string(b);    a->flags |= STRING_NOT_HASHED;    return end_shared_string(a);    }else{    struct pike_string *ret=add_shared_strings(a,b);    free_string(a);    free_string(b);    return ret;    }   }
pike.git/src/stralloc.c:2352:   {    init_string_builder_alloc(s, 256, mag);   }      PMOD_EXPORT void init_string_builder_copy(struct string_builder *to,    struct string_builder *from)   {    to->malloced = from->malloced;    to->s = begin_wide_shared_string (from->malloced, from->s->size_shift);    to->s->len = from->s->len; -  MEMCPY (to->s->str, from->s->str, (from->s->len + 1) << from->s->size_shift); +  memcpy (to->s->str, from->s->str, (from->s->len + 1) << from->s->size_shift);    to->known_shift = from->known_shift;   }      /* str becomes invalid if successful (i.e. nonzero returned),    * otherwise nothing happens. */   PMOD_EXPORT int init_string_builder_with_string (struct string_builder *s,    struct pike_string *str)   {    if (str->refs == 1 && str->len > SHORT_STRING_THRESHOLD) {    /* Unlink the string and use it as buffer directly. */
pike.git/src/stralloc.c:2639:    PCHARP to;    tmp=MINIMUM(howmany, len);    to=MKPCHARP_STR_OFF(s->s,s->s->len);    generic_memcpy(to,from, tmp);    s->s->len+=tmp;    howmany-=tmp;       while(howmany > 0)    {    tmp = MINIMUM(len, howmany); -  MEMCPY(s->s->str + (s->s->len << s->s->size_shift), +  memcpy(s->s->str + (s->s->len << s->s->size_shift),    to.ptr,    tmp << s->s->size_shift);    len+=tmp;    howmany-=tmp;    s->s->len+=tmp;    }    }    /* Ensure NUL-termination */    s->s->str[s->s->len << s->s->size_shift] = 0;   }