Branch: Tag:

2001-06-06

2001-06-06 02:22:36 by Martin Stjernholm <mast@lysator.liu.se>

Fixed [bug 1728 (#1728)] where setting the weak flag on an empty array or multiset
caused multisets created later to also be weak.

Rev: src/array.c:1.102
Rev: src/array.h:1.31
Rev: src/builtin_functions.c:1.340
Rev: src/gc.c:1.145
Rev: src/testsuite.in:1.386

5:   \*/   /**/   #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.339 2001/06/06 01:12:30 mast Exp $"); + RCSID("$Id: builtin_functions.c,v 1.340 2001/06/06 02:22:36 mast Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
3180:   {    struct svalue *s;    INT_TYPE ret; +  int flags;       get_all_args("set_weak_flag",args,"%*%i",&s,&ret);       switch(s->type)    {    case T_ARRAY: -  SETFLAG(s->u.array->flags,ARRAY_WEAK_FLAG,ret); +  flags = array_get_flags(s->u.array); +  SETFLAG(flags,ARRAY_WEAK_FLAG,ret); +  s->u.array = array_set_flags(s->u.array, flags);    break; -  case T_MAPPING: { -  int flags = mapping_get_flags(s->u.mapping); +  case T_MAPPING: +  flags = mapping_get_flags(s->u.mapping);    SETFLAG(flags,MAPPING_FLAG_WEAK,ret);    mapping_set_flags(s->u.mapping, flags);    break; -  } +     case T_MULTISET: -  SETFLAG(s->u.multiset->ind->flags,(ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK),ret); +  flags = array_get_flags(s->u.multiset->ind); +  SETFLAG(flags,(ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK),ret); +  s->u.multiset->ind = array_set_flags(s->u.multiset->ind, flags);    break;    default:    SIMPLE_BAD_ARG_ERROR("set_weak_flag",1,"array|mapping|multiset");