pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:5:   \*/   /**/   #include "global.h"   #include "svalue.h"   #include "array.h"   #include "object.h"   #include "las.h"   #include "stralloc.h"   #include "interpret.h"   #include "opcodes.h" - #include "error.h" + #include "pike_error.h"   #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.96 2000/12/01 01:14:56 hubbe Exp $"); + RCSID("$Id: array.c,v 1.97 2000/12/01 08:09:43 hubbe Exp $");      PMOD_EXPORT struct array empty_array=   {    1, /* Never free */   #ifdef PIKE_SECURITY    0,   #endif    &empty_array, /* Next */    &empty_array, /* previous (circular) */    0, /* Size = 0 */
pike.git/src/array.c:55:       if(size == 0)    {    add_ref(&empty_array);    return &empty_array;    }       v=(struct array *)malloc(sizeof(struct array)+    (size+extra_space-1)*sizeof(struct svalue));    if(!v) -  error("Couldn't allocate array, out of memory.\n"); +  Pike_error("Couldn't allocate array, out of memory.\n");       GC_ALLOC(v);          /* for now, we don't know what will go in here */    v->type_field=BIT_MIXED | BIT_UNFINISHED;    v->flags=0;       v->malloced_size = DO_NOT_WARN((INT32)(size + extra_space));    v->size = DO_NOT_WARN((INT32)size);
pike.git/src/array.c:239:      PMOD_EXPORT void simple_set_index(struct array *a,struct svalue *ind,struct svalue *s)   {    INT32 i;    switch (ind->type) {    case T_INT:    i=ind->u.integer;    if(i<0) i+=a->size;    if(i<0 || i>=a->size) {    if (a->size) { -  error("Index %d is out of array range 0 - %d.\n", i, a->size-1); +  Pike_error("Index %d is out of array range 0 - %d.\n", i, a->size-1);    } else { -  error("Attempt to index the empty array with %d.\n", i); +  Pike_error("Attempt to index the empty array with %d.\n", i);    }    }    array_set_index(a,i,s);    break;       case T_STRING:    {    INT32 i, n;    check_stack(2);    Pike_sp++->type = T_VOID;
pike.git/src/array.c:1026:    * type. The 'union anything' may be changed, but not the type.    * The differance between this routine and the one above is that this takes    * the index as an svalue.    */   PMOD_EXPORT union anything *array_get_item_ptr(struct array *a,    struct svalue *ind,    TYPE_T t)   {    INT32 i;    if(ind->type != T_INT) -  error("Index is not an integer.\n"); +  Pike_error("Index is not an integer.\n");    i=ind->u.integer;    if(i<0) i+=a->size;    if(i<0 || i>=a->size) {    if (a->size) { -  error("Index %d is out of array range 0 - %d.\n", i, a->size-1); +  Pike_error("Index %d is out of array range 0 - %d.\n", i, a->size-1);    } else { -  error("Attempt to index the empty array with %d.\n", i); +  Pike_error("Attempt to index the empty array with %d.\n", i);    }    }    return low_array_get_item_ptr(a,i,t);   }      /*    * organize an array of INT32 to specify how to zip two arrays together    * to maintain the order.    * the first item in this array is the size of the result    * the rest is n >= 0 for a[ n ]
pike.git/src/array.c:2285:   }      PMOD_EXPORT struct array *implode_array(struct array *a, struct array *b)   {    INT32 e,size;    struct array *ret;    size=0;    for(e=0;e<a->size;e++)    {    if(ITEM(a)[e].type!=T_ARRAY) -  error("Implode array contains non-arrays.\n"); +  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;    ret->type_field=0;    for(e=0;e<a->size;e++)    {    if(e)    {