pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:1925:   #define CMP(X,Y) set_svalue_cmpfun(X,Y)   #define TYPE struct svalue   #define ID set_sort_svalues   #include "fsort_template.h"   #undef CMP   #undef TYPE   #undef ID      /** Remove all instances of an svalue from an array   */ - static struct array *subtract_array_svalue(struct array *a, struct svalue *b) + PMOD_EXPORT struct array *subtract_array_svalue(struct array *a, +  struct svalue *b)   {    size_t size = a->size;    size_t from=0, to=0;    TYPE_FIELD to_type = 1<<TYPEOF(*b);    TYPE_FIELD type_field = 0;    ONERROR ouch;    struct svalue *ip=ITEM(a), *dp=ip;    int destructive = 1;       if( size == 0 )
pike.git/src/array.c:2099:       if(!a->size)    return mkefuncallnode("aggregate",0);    if (a->size == 1)    return mkefuncallnode("aggregate", mksvaluenode(ITEM(a)));       if(array_fix_type_field(a) == BIT_INT)    {    debug_malloc_touch(a);    for(e=0; e<a->size; e++) -  if(ITEM(a)[e].u.integer != 0) +  if(ITEM(a)[e].u.integer || SUBTYPEOF(ITEM(a)[e]))    break;    if(e == a->size)    {    return mkefuncallnode("allocate",mkintnode(a->size));    }    }    debug_malloc_touch(a);    if(!is_more_than_one_bit(a->type_field))    {    e=0;    debug_malloc_touch(a);    switch(a->type_field)    {    case BIT_INT:    for(e=1; e<a->size; e++) -  if(ITEM(a)[e].u.integer != ITEM(a)[0].u.integer) +  if((ITEM(a)[e].u.integer != ITEM(a)[0].u.integer) || +  (SUBTYPEOF(ITEM(a)[e]) != SUBTYPEOF(ITEM(a)[0]))) {    break; -  if(e==a->size && ITEM(a)[0].u.integer==0) +  } +  if(e==a->size && ITEM(a)[0].u.integer==0 && !SUBTYPEOF(ITEM(a)[0]))    return mkefuncallnode("allocate",mkintnode(a->size));    break;       case BIT_STRING:    case BIT_PROGRAM:    for(e=1; e<a->size; e++)    if(ITEM(a)[e].u.refs != ITEM(a)[0].u.refs)    break;    break;   
pike.git/src/array.c:2266:    a=allocate_array_no_init(args,0);    if (args) {    memcpy(ITEM(a),Pike_sp-args,args*sizeof(struct svalue));    array_fix_type_field (a);    Pike_sp-=args;    DO_IF_DMALLOC(while(args--) dmalloc_touch_svalue(Pike_sp + args));    }    return a;   }    - /** Add an element to the end of an array by resizing the array. + /** +  * Add an element to the end of an array by resizing the array.    *    * @param a the array to be appended    * @param s the value to be added to the new element in the array    */   PMOD_EXPORT struct array *append_array(struct array *a, struct svalue *s)   {    INT32 size = a->size;    a=resize_array(a, size+1);    array_set_index(a, size, s);    return a;   }    - /** Automap assignments + /** +  * Automap assignments    * This implements X[*] = ...[*]..    * Assign elements in a at @level to elements from b at the same @level.    * This will not actually modify any of the arrays, only change the    * values in them.    */   void assign_array_level( struct array *a, struct array *b, int level )   {    if( a->size != b->size )    /* this should not really happen. */    Pike_error("Source and destination differs in size in automap?!\n");