pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:1:   /*   || 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.159 2004/05/13 23:28:49 nilsson Exp $ + || $Id: array.c,v 1.160 2004/05/28 16:08:24 grubba Exp $   */      #include "global.h"   #include "svalue.h"   #include "array.h"   #include "object.h"   #include "las.h"   #include "stralloc.h"   #include "interpret.h"   #include "opcodes.h"
pike.git/src/array.c:19:   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "pike_security.h"   #include "stuff.h"   #include "bignum.h"   #include "cyclic.h"   #include "multiset.h"    - RCSID("$Id: array.c,v 1.159 2004/05/13 23:28:49 nilsson Exp $"); + RCSID("$Id: array.c,v 1.160 2004/05/28 16:08:24 grubba Exp $");      PMOD_EXPORT struct array empty_array=   {    PIKE_CONSTANT_MEMOBJ_INIT(1), /* Never free */    &weak_empty_array, /* Next */    0, /* previous */    0, /* Size = 0 */    0, /* malloced Size = 0 */    0, /* no types */    0, /* no flags */
pike.git/src/array.c:2089:    inited=1;    tmp=ITEM(a)[e].u.string;    pike_string_cpy(r,tmp);    INC_PCHARP(r,tmp->len);    len++;    }    }    return low_end_shared_string(ret);   }    - PMOD_EXPORT struct array *copy_array_recursively(struct array *a,struct processing *p) + PMOD_EXPORT struct array *copy_array_recursively(struct array *a, +  struct mapping *m)   { -  struct processing doing; +     struct array *ret; -  +  struct svalue aa, bb;      #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif    -  doing.next=p; -  doing.pointer_a=(void *)a; -  for(;p;p=p->next) -  { -  if(p->pointer_a == (void *)a) -  { -  ret=(struct array *)p->pointer_b; -  add_ref(ret); -  return ret; -  } -  } -  +     ret=allocate_array_no_init(a->size,0); -  doing.pointer_b=(void *)ret; +     -  +  aa.type = T_ARRAY; +  aa.subtype = 0; +  aa.u.array = a; +  bb.type = T_ARRAY; +  bb.subtype = 0; +  bb.u.array = ret; +  low_mapping_insert(m, &aa, &bb); +     ret->flags = a->flags & ~ARRAY_LVALUE;    -  copy_svalues_recursively_no_free(ITEM(ret),ITEM(a),a->size,&doing); +  copy_svalues_recursively_no_free(ITEM(ret),ITEM(a),a->size,m);       ret->type_field=a->type_field;    return ret;   }      PMOD_EXPORT void apply_array(struct array *a, INT32 args)   {    INT32 e;    struct svalue *argp = Pike_sp-args;    TYPE_FIELD new_types = 0;