pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:410:    }    assert_free_svalue (ITEM(v) + index);    v->size++;    }else{    struct array *ret;       ret = array_set_flags(allocate_array_no_init(v->size+1, v->size + 1),    v->flags);    ret->type_field = v->type_field;    -  MEMCPY(ITEM(ret), ITEM(v), sizeof(struct svalue) * index); -  MEMCPY(ITEM(ret)+index+1, ITEM(v)+index, +  memcpy(ITEM(ret), ITEM(v), sizeof(struct svalue) * index); +  memcpy(ITEM(ret)+index+1, ITEM(v)+index,    sizeof(struct svalue) * (v->size-index));    assert_free_svalue (ITEM(ret) + index);    if (v->refs == 1) {    /* Optimization: Steal the references. */    v->size = 0;    } else if (v->type_field & BIT_REF_TYPES) {    /* Adjust the references. */    int e = v->size;    struct svalue *s = ITEM(ret);    while (e--) {
pike.git/src/array.c:549:    free_svalues(ITEM(v) + size, v->size - size, v->type_field);    v->size=size;       if(size*4 < v->malloced_size + 4) /* Should we realloc it? */    {    a = array_set_flags(allocate_array_no_init(size, 0), v->flags);    if (a->size) {    a->type_field = v->type_field;    }    -  MEMCPY(ITEM(a), ITEM(v), size*sizeof(struct svalue)); +  memcpy(ITEM(a), ITEM(v), size*sizeof(struct svalue));    v->size=0;    free_array(v);    return a;    }else{    return v;    }   }      /**    * Resize an array destructively, with the exception that a may be one
pike.git/src/array.c:588:    {    for(;a->size < size; a->size++)    {    SET_SVAL(ITEM(a)[a->size], T_INT, NUMBER_NUMBER, integer, 0);    }    a->type_field |= BIT_INT;    return a;    } else {    struct array *ret;    ret = array_set_flags(low_allocate_array(size, size + 1), a->flags); -  MEMCPY(ITEM(ret), ITEM(a), sizeof(struct svalue)*a->size); +  memcpy(ITEM(ret), ITEM(a), sizeof(struct svalue)*a->size);    ret->type_field = DO_NOT_WARN((TYPE_FIELD)(a->type_field | BIT_INT));    a->size=0;    free_array(a);    return ret;    }    } else {    return array_shrink(a, size);    }   }   
pike.git/src/array.c:631:    /* NOTE: The following uses the fact that array_set_flags()    * will reallocate the array if it has zero size!    */    return array_set_flags(v, v->flags);    } else if(v->size*4 + 4 < v->malloced_size ) /* Should we realloc it? */    {    a = array_set_flags(allocate_array_no_init(v->size-1, 0), v->flags);    a->type_field = v->type_field;       if(index>0) -  MEMCPY(ITEM(a), ITEM(v), index*sizeof(struct svalue)); +  memcpy(ITEM(a), ITEM(v), index*sizeof(struct svalue));    if(v->size-index>1) -  MEMCPY(ITEM(a)+index, +  memcpy(ITEM(a)+index,    ITEM(v)+index+1,    (v->size-index-1)*sizeof(struct svalue));    v->size=0;    free_array(v);    return a;    } else {    if(v->size-index>1)    {    MEMMOVE((char *)(ITEM(v)+index),    (char *)(ITEM(v)+index+1),
pike.git/src/array.c:2151:   }      /** Push elements of an array onto the stack. The array will be freed.    */   PMOD_EXPORT void push_array_items(struct array *a)   {    check_stack(a->size);    check_array_for_destruct(a);    if(a->refs == 1)    { -  MEMCPY(Pike_sp,ITEM(a),sizeof(struct svalue)*a->size); +  memcpy(Pike_sp,ITEM(a),sizeof(struct svalue)*a->size);    Pike_sp += a->size;    a->size=0;    free_array(a);    }else{    assign_svalues_no_free(Pike_sp, ITEM(a), a->size, a->type_field);    Pike_sp += a->size;    free_array(a);    }   }   
pike.git/src/array.c:2248:    * Pops a number of arguments off of the stack an puts them in an array.    * The 'top' of the stack will be the last element in the array.    * @param args The number of arguments to aggregate.    */   PMOD_EXPORT struct array *aggregate_array(INT32 args)   {    struct array *a;       a=allocate_array_no_init(args,0);    if (args) { -  MEMCPY((char *)ITEM(a),(char *)(Pike_sp-args),args*sizeof(struct svalue)); +  memcpy((char *)ITEM(a),(char *)(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.    *    * @param a the array to be appended