pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:263:    array_set_index(v,index,s);       return v;   }      /*    * resize array, resize an array destructively    */   struct array *resize_array(struct array *a, INT32 size)   { + #ifdef DEBUG +  if(d_flag > 1) array_check_type_field(a); + #endif +     if(a->size == size) return a;    if(size > a->size)    {    /* We should grow the array */       if(a->malloced_size >= size)    {    for(;a->size < size; a->size++)    {    ITEM(a)[a->size].type=T_INT;
pike.git/src/array.c:418:    * Slice a pice of an array (nondestructively)    * return an array consisting of v[start..end-1]    */   struct array *slice_array(struct array *v,INT32 start,INT32 end)   {    struct array *a;      #ifdef DEBUG    if(start > end || end>v->size || start<0)    fatal("Illegal arguments to slice_array()\n"); +  +  if(d_flag > 1) array_check_type_field(v);   #endif       if(start==0 && v->refs==1) /* Can we use the same array? */    {    v->refs++;    return array_shrink(v,end);    }       a=allocate_array_no_init(end-start,0);    a->type_field = v->type_field;
pike.git/src/array.c:445:    * Slice a pice of an array (nondestructively)    * return an array consisting of v[start..end-1]    */   struct array *friendly_slice_array(struct array *v,INT32 start,INT32 end)   {    struct array *a;      #ifdef DEBUG    if(start > end || end>v->size || start<0)    fatal("Illegal arguments to slice_array()\n"); +  +  if(d_flag > 1) array_check_type_field(v);   #endif       a=allocate_array_no_init(end-start,0);    a->type_field = v->type_field;       assign_svalues_no_free(ITEM(a), ITEM(v)+start, end-start, v->type_field);       return a;   }   
pike.git/src/array.c:1281:   {    struct array *a;       a=allocate_array_no_init(args,0);    MEMCPY((char *)ITEM(a),(char *)(sp-args),args*sizeof(struct svalue));    a->type_field=BIT_MIXED;    sp-=args;    return a;   }    + struct array *append_array(struct array *a, struct svalue *s) + { +  a=resize_array(a,a->size+1); +  array_set_index(a, a->size-1, s); +  return a; + } +    struct array *explode(struct pike_string *str,    struct pike_string *del)   {    INT32 e;    struct array *ret;    char *s, *end, *tmp;       if(!del->len)    {    ret=allocate_array_no_init(str->len,0);
pike.git/src/array.c:1378:    }    }    return 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 +     doing.next=p;    doing.pointer_a=(void *)a;    for(;p;p=p->next)    {    if(p->pointer_a == (void *)a)    {    ret=(struct array *)p->pointer_b;    ret->refs++;    return ret;    }    }       ret=allocate_array_no_init(a->size,0);    doing.pointer_b=(void *)ret;       copy_svalues_recursively_no_free(ITEM(ret),ITEM(a),a->size,&doing); -  +  +  ret->type_field=a->type_field;    return ret;   }      void apply_array(struct array *a, INT32 args)   {    INT32 e;    struct array *ret;    INT32 argp;       argp=sp-args - evaluator_stack;