pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:12:   #include "interpret.h"   #include "language.h"   #include "error.h"   #include "pike_types.h"   #include "fsort.h"   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"    - RCSID("$Id: array.c,v 1.40 1998/10/11 11:18:50 hubbe Exp $"); + RCSID("$Id: array.c,v 1.41 1998/10/14 05:48:44 hubbe Exp $");      struct array empty_array=   {    1, /* Never free */    &empty_array, /* Next */    &empty_array, /* previous (circular) */    0, /* Size = 0 */    0, /* malloced Size = 0 */    0, /* no types */    0, /* no flags */
pike.git/src/array.c:1417:    ITEM(ret)[ret->size].type=T_STRING;    ret->size++;    }    ret->type_field=BIT_STRING;    return ret;   }      struct pike_string *implode(struct array *a,struct pike_string *del)   {    INT32 len,e, inited; -  char *r; +  PCHARP r;    struct pike_string *ret,*tmp;    int max_shift=0;       len=0;       for(e=0;e<a->size;e++)    {    if(ITEM(a)[e].type==T_STRING)    {    len+=ITEM(a)[e].u.string->len + del->len;    if(ITEM(a)[e].u.string->size_shift > max_shift)    max_shift=ITEM(a)[e].u.string->size_shift;    }    } -  +  if(del->size_shift > max_shift) max_shift=del->size_shift;    if(len) len-=del->len;       ret=begin_wide_shared_string(len,max_shift); -  r=ret->str; +  r=MKPCHARP_STR(ret);    inited=0;    for(e=0;e<a->size;e++)    {    if(ITEM(a)[e].type==T_STRING)    {    if(inited)    { -  pike_string_cpy(r,max_shift,del); -  r+=del->len << max_shift; +  pike_string_cpy(r,del); +  INC_PCHARP(r,del->len);    }    inited=1;    tmp=ITEM(a)[e].u.string; -  pike_string_cpy(r,max_shift,tmp); -  r+=tmp->len << max_shift; +  pike_string_cpy(r,tmp); +  INC_PCHARP(r,tmp->len);    len++;    }    } -  return end_shared_string(ret); +  return low_end_shared_string(ret);   }      struct array *copy_array_recursively(struct array *a,struct processing *p)   {    struct processing doing;    struct array *ret;      #ifdef DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif