pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:16:   #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.115 2001/07/01 21:34:50 mast Exp $"); + RCSID("$Id: array.c,v 1.116 2001/08/31 06:53:36 hubbe Exp $");      PMOD_EXPORT struct array empty_array=   {    PIKE_CONSTANT_MEMOBJ_INIT(1), /* Never free */    &weak_empty_array, /* Next */    &weak_shrink_empty_array, /* previous (circular) */    0, /* Size = 0 */    0, /* malloced Size = 0 */    0, /* no types */    0, /* no flags */
pike.git/src/array.c:158:    add_ref(a = &weak_empty_array); break;    case ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK:    add_ref(a = &weak_shrink_empty_array); break;    default:    fatal("Invalid flags %x\n", flags);    }    }    return a;   }    - /* -  * Extract an svalue from an array -  */ - PMOD_EXPORT void array_index_no_free(struct svalue *s,struct array *v,INT32 index) - { - #ifdef PIKE_DEBUG -  if(index<0 || index>=v->size) -  fatal("Illegal index in low level index routine.\n"); - #endif +     -  assign_svalue_no_free(s, ITEM(v) + index); - } -  +    /*    * Extract an svalue from an array    */   PMOD_EXPORT void array_index(struct svalue *s,struct array *v,INT32 index)   {   #ifdef PIKE_DEBUG    if(index<0 || index>=v->size)    fatal("Illegal index in low level index routine.\n");   #endif   
pike.git/src/array.c:243:   PMOD_EXPORT 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       free_svalue(ITEM(v) + index);   }    - /* -  * Set an index in an array -  */ - PMOD_EXPORT void array_set_index(struct array *v,INT32 index, struct svalue *s) - { - #ifdef PIKE_DEBUG -  if(index<0 || index>v->size) -  fatal("Illegal index in low level array set routine.\n"); - #endif +     -  add_ref(v); -  check_destructed(s); -  -  v->type_field = (v->type_field & ~BIT_UNFINISHED) | (1 << s->type); -  assign_svalue( ITEM(v) + index, s); -  free_array(v); - } -  -  +    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) {    Pike_error("Index %d is out of array range 0 - %d.\n", i, a->size-1);