Branch: Tag:

2004-09-18

2004-09-18 15:25:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fix for LP64.

Rev: src/array.c:1.168

2:   || 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"
27:   #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=   {
77:      /* 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;
93:       /* 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)