pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: array.c,v 1.211 2008/07/01 09:36:28 mast Exp $ + || $Id: array.c,v 1.212 2008/07/04 15:50:46 mast Exp $   */      #include "global.h"   #include "svalue.h"   #include "array.h"   #include "object.h"   #include "las.h"   #include "stralloc.h"   #include "interpret.h"   #include "opcodes.h"
pike.git/src/array.c:557:    MEMCPY(ITEM(a), ITEM(v), size*sizeof(struct svalue));    v->size=0;    free_array(v);    return a;    }else{    return v;    }   }      /** -  * Resize an array destructively. +  * Resize an array destructively, with the exception that a may be one +  * of the static empty arrays.    */   PMOD_EXPORT struct array *resize_array(struct array *a, INT32 size)   {   #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif       /* Ensure that one of the empty arrays are returned if size is zero. */ -  if (!size) return array_shrink (a, size); +  if (!size && a->malloced_size) return array_shrink (a, size);       if(a->size == size) return a;    if(size > a->size)    {    /* We should grow the array */       if((a->malloced_size >= size) &&    ((a->item + size) <= (a->real_item + a->malloced_size)))    {    for(;a->size < size; a->size++)