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.167 2004/09/17 15:02:58 nilsson Exp $ + || $Id: array.c,v 1.168 2004/09/18 15:25:34 grubba 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:20:   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "pike_security.h"   #include "stuff.h"   #include "bignum.h"   #include "cyclic.h"   #include "multiset.h"   #include "mapping.h"    - RCSID("$Id: array.c,v 1.167 2004/09/17 15:02:58 nilsson Exp $"); + RCSID("$Id: array.c,v 1.168 2004/09/18 15:25:34 grubba Exp $");      PMOD_EXPORT struct array empty_array=   {    PIKE_CONSTANT_MEMOBJ_INIT(1), /* Never free */    &weak_empty_array, /* Next */    0, /* previous */    0, /* Size = 0 */    0, /* malloced Size = 0 */    0, /* no types */    0, /* no flags */
pike.git/src/array.c:70: Inside #if defined(TRACE_UNFINISHED_TYPE_FIELDS)
  PMOD_EXPORT int accept_unfinished_type_fields = 0;   PMOD_EXPORT void dont_accept_unfinished_type_fields (void *orig)   {    accept_unfinished_type_fields = (int) orig;   }   #endif         /* Allocate an array, this might be changed in the future to    * allocate linked lists or something -  * NOTE: the new array have zero references +  * NOTE: the new array has zero references    */    - PMOD_EXPORT struct array *low_allocate_array(ptrdiff_t size, ptrdiff_t extra_space) + PMOD_EXPORT struct array *low_allocate_array(ptrdiff_t size, +  ptrdiff_t extra_space)   {    struct array *v;    ptrdiff_t e;       if(size+extra_space == 0)    {    add_ref(&empty_array);    return &empty_array;    }       /* Limits size to (1<<29)-4 */    if( (size+extra_space-1) > -  (INT32)((ULONG_MAX-sizeof(struct array))/sizeof(struct svalue)) ) -  Pike_error("Too large array (memory size exceeds size of size_t)\n"); +  (LONG_MAX-sizeof(struct array))/sizeof(struct svalue) ) +  Pike_error("Too large array (size %ld exceeds %ld).\n", +  (long)(size+extra_space-1), +  (long)((LONG_MAX-sizeof(struct array))/sizeof(struct svalue)) );    v=(struct array *)malloc(sizeof(struct array)+    (size+extra_space-1)*sizeof(struct svalue));    if(!v)    Pike_error(msg_out_of_mem);       GC_ALLOC(v);          if (size)    /* for now, we don't know what will go in here */