diff --git a/src/array.c b/src/array.c index 4be78178b79a9a1b64e92cc69aab7eda5a1397e8..5ec1df37e6b5c1a5768361647595ce789c952329 100644 --- a/src/array.c +++ b/src/array.c @@ -262,6 +262,7 @@ static struct array *resize_array(struct array *a, INT32 size) if(size > a->size) { /* We should grow the array */ + if(a->malloced_size >= size) { for(;a->size < size; a->size++) @@ -274,7 +275,7 @@ static struct array *resize_array(struct array *a, INT32 size) return a; }else{ struct array *ret; - ret=allocate_array_no_init(size, (size>>3)+1); + ret=low_allocate_array(size, (size>>3)+1); MEMCPY(ITEM(ret),ITEM(a),sizeof(struct svalue)*a->size); ret->type_field = a->type_field | BIT_INT; a->size=0; diff --git a/src/svalue.c b/src/svalue.c index 31261d67b5a09df260ac890a92a4d46045887470..be0e092c051642e1f59704882a6fc80ebe2107d7 100644 --- a/src/svalue.c +++ b/src/svalue.c @@ -178,20 +178,29 @@ void assign_svalues_no_free(struct svalue *to, INT32 num, INT32 type_hint) { - if((type_hint & ~(BIT_INT | BIT_FLOAT))==0) +#ifdef DEBUG + if(d_flag) + { + INT32 e,t; + for(t=e=0;e<num;e++) t|=1<<from[e].type; + if(t & ~type_hint) + fatal("Type hint lies!\n"); + } +#endif + if((type_hint & ((2<<MAX_REF_TYPE)-1)) == 0) { MEMCPY((char *)to, (char *)from, sizeof(struct svalue) * num); return; } - if(((type_hint & (BIT_INT | BIT_FLOAT))==0)) + if((type_hint & ((2<<MAX_REF_TYPE)-1)) == type_hint) { while(--num >= 0) { struct svalue tmp; tmp=*(from++); *(to++)=tmp; - tmp.u.refs++; + tmp.u.refs[0]++; } return; }