Branch: Tag:

2008-07-13

2008-07-13 15:18:29 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Only perform destructive operations with apply_array() in APPLY_SVALUE_STRICT mode.

Rev: src/array.c:1.215
Rev: src/array.h:1.79
Rev: src/interpret.c:1.405

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: array.c,v 1.214 2008/07/12 10:21:12 grubba Exp $ + || $Id: array.c,v 1.215 2008/07/13 15:18:29 grubba Exp $   */      #include "global.h"
2453:    * Note that the array a may be modified destructively if it has    * only a single reference.    */ - PMOD_EXPORT void apply_array(struct array *a, INT32 args) + PMOD_EXPORT void apply_array(struct array *a, INT32 args, int flags)   {    INT32 e, hash = 0;    struct svalue *argp = Pike_sp-args;
2467:       if (!(cycl = (struct array *)BEGIN_CYCLIC(a, (ptrdiff_t)hash))) {    TYPE_FIELD new_types = 0; -  if (a->refs == 1) { +  if ((flags & 1) && (a->refs == 1)) {    /* Destructive operation possible. */    ref_push_array(a);    a->type_field |= BIT_UNFINISHED;