pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:453: Inside #if defined(PIKE_DEBUG)
   Pike_fatal("Too few arguments to o_append_array(): %d\n", args);    }   #endif    args -= 3;    /* Note: val should always be a zero here! */    lvalue_to_svalue_no_free(val, lval);       if (TYPEOF(*val) == T_ARRAY) {    struct svalue tmp;    struct array *v = val->u.array; +  /* simple case: if refs == 2 and there is space, just add the +  element and do not do the assign. This can be done because the +  lvalue already has the array as it's value. +  */ +  if( v->refs == 2 ) +  { +  if( v->real_item+v->malloced_size >= v->item+v->size+args ) +  { +  struct svalue *from = val+1; +  int i; +  for( i = 0; i<args; i++,from++ ) +  { +  v->item[v->size++] = *from; +  v->type_field |= 1<<TYPEOF(*from); +  } +  Pike_sp -= args; +  stack_pop_2_elems_keep_top(); +  return; +  } +  }    /* This is so that we can minimize the number of references    * to the array, and be able to use destructive operations.    * It's done by freeing the old reference to foo after it has been    * pushed on the stack. That way foo can have only 1 reference if we    * are lucky, and then the low array manipulation routines can    * be destructive if they like.    */    SET_SVAL(tmp, PIKE_T_INT, NUMBER_NUMBER, integer, 0);    assign_lvalue(lval, &tmp);