pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:16:   #include "pike_types.h"   #include "fsort.h"   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "security.h"   #include "stuff.h"   #include "bignum.h"    - RCSID("$Id: array.c,v 1.123 2002/01/16 02:54:07 nilsson Exp $"); + RCSID("$Id: array.c,v 1.124 2002/03/06 11:01:59 grubba Exp $");      PMOD_EXPORT struct array empty_array=   {    PIKE_CONSTANT_MEMOBJ_INIT(1), /* Never free */    &weak_empty_array, /* Next */    &weak_shrink_empty_array, /* previous (circular) */    0, /* Size = 0 */    0, /* malloced Size = 0 */    0, /* no types */    0, /* no flags */
pike.git/src/array.c:2371:    }    } END_AGGREGATE_ARRAY;    }    tmp=(--Pike_sp)->u.array;    if(tmp->size) tmp->type_field=BIT_ARRAY;    return tmp;   }      PMOD_EXPORT struct array *implode_array(struct array *a, struct array *b)   { -  INT32 e,size; +  INT32 e, size;    struct array *ret; -  +  +  if (!a->size) { +  add_ref(a); +  return a; +  } +     size=0;    for(e=0;e<a->size;e++)    {    if(ITEM(a)[e].type!=T_ARRAY)    Pike_error("Implode array contains non-arrays.\n");    size+=ITEM(a)[e].u.array->size;    }       ret=allocate_array((a->size -1) * b->size + size);    size=0;
pike.git/src/array.c:2404:    }    ret->type_field|=ITEM(a)[e].u.array->type_field;    assign_svalues_no_free(ITEM(ret)+size,    ITEM(ITEM(a)[e].u.array),    ITEM(a)[e].u.array->size,    ITEM(a)[e].u.array->type_field);    size+=ITEM(a)[e].u.array->size;    }   #ifdef PIKE_DEBUG    if(size != ret->size) -  fatal("Implode_array failed miserably\n"); +  fatal("Implode_array failed miserably (%d != %d)\n", size, ret->size);   #endif    return ret;   }