pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:13:   #include "language.h"   #include "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"    - RCSID("$Id: array.c,v 1.44 1999/03/05 02:14:31 hubbe Exp $"); + RCSID("$Id: array.c,v 1.45 1999/03/19 11:40:12 hubbe Exp $");      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:161:   void simple_array_index_no_free(struct svalue *s,    struct array *a,struct svalue *ind)   {    INT32 i;    switch(ind->type)    {    case T_INT:    i=ind->u.integer;    if(i<0) i+=a->size;    if(i<0 || i>=a->size) { +  struct svalue tmp; +  tmp.type=T_ARRAY; +  tmp.u.array=a;    if (a->size) { -  error("Index %d is out of range 0 - %d.\n", i, a->size-1); +  index_error(0,0,0,&tmp,ind,"Index %d is out of range 0 - %d.\n", i, a->size-1);    } else { -  error("Attempt to index the empty array with %d.\n", i); +  index_error(0,0,0,&tmp,ind,"Attempt to index the empty array with %d.\n", i);    }    }    array_index_no_free(s,a,i);    break;       case T_STRING:    check_stack(4);    ref_push_array(a);    assign_svalue_no_free(sp++,ind);    f_column(2);    s[0]=sp[-1];    sp--;    break;       default: -  error("Index is not an integer.\n"); +  { +  struct svalue tmp; +  tmp.type=T_ARRAY; +  tmp.u.array=a; +  index_error(0,0,0,&tmp,ind,"Index is not an integer.\n");    }    } -  + }      /*    * Extract an svalue from an array    */   void array_free_index(struct array *v,INT32 index)   {   #ifdef PIKE_DEBUG    if(index<0 || index>=v->size)    fatal("Illegal index in low level free index routine.\n");   #endif