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.112 2001/06/11 18:03:23 mast Exp $"); + RCSID("$Id: array.c,v 1.113 2001/06/26 12:42:48 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:574:    return a;   }      /*    * Copy an array    */   PMOD_EXPORT struct array *copy_array(struct array *v)   {    struct array *a;    +  if (!v->size) { +  /* Empty array. */ +  add_ref(&empty_array); +  return &empty_array; +  } +     a=allocate_array_no_init(v->size, 0);    a->type_field = v->type_field;       assign_svalues_no_free(ITEM(a), ITEM(v), v->size, v->type_field);       return a;   }      /*    * Clean an array from destructed objects