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.83 2000/08/15 16:19:12 grubba Exp $"); + RCSID("$Id: array.c,v 1.84 2000/08/16 15:54:07 grubba 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:64:    if(!v)    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=size+extra_space; -  v->size=size; +  v->malloced_size = DO_NOT_WARN((INT32)(size + extra_space)); +  v->size = DO_NOT_WARN((INT32)size);    v->refs=1;    LINK_ARRAY(v);       INITIALIZE_PROT(v);       for(e=0;e<v->size;e++)    {    ITEM(v)[e].type=T_INT;    ITEM(v)[e].subtype=NUMBER_NUMBER;    ITEM(v)[e].u.integer=0;
pike.git/src/array.c:360:    /* We should shrink the array */    free_svalues(ITEM(a)+size, a->size - size, a->type_field);    a->size = size;    return a;    }   }      /*    * Shrink an array destructively    */ - PMOD_EXPORT struct array *array_shrink(struct array *v,INT32 size) + PMOD_EXPORT struct array *array_shrink(struct array *v, ptrdiff_t size)   {    struct array *a;      #ifdef PIKE_DEBUG    if(v->refs>2) /* Odd, but has to be two */    fatal("Array shrink on array with many references.\n");       if(size > v->size)    fatal("Illegal argument to array_shrink.\n");   #endif
pike.git/src/array.c:1735:    ret=allocate_array_no_init(a->size,0);    for(e=0;e<a->size;e++)    assign_svalue_no_free(ITEM(ret)+e,ITEM(a)+a->size+~e);    return ret;   }      PMOD_EXPORT void array_replace(struct array *a,    struct svalue *from,    struct svalue *to)   { -  INT32 i = -1; +  ptrdiff_t i = -1;       while((i=array_search(a,from,i+1)) >= 0) array_set_index(a,i,to);   }      #ifdef PIKE_DEBUG   PMOD_EXPORT void check_array(struct array *a)   {    INT32 e;       if(a->next->prev != a)