Branch: Tag:

2001-06-06

2001-06-06 02:22:29 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.67
Rev: src/array.h:1.19
Rev: src/builtin_functions.c:1.261

5:   \*/   /**/   #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.260 2000/10/04 22:50:00 hubbe Exp $"); + RCSID("$Id: builtin_functions.c,v 1.261 2001/06/06 02:22:29 mast Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
2357:   {    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:    SETFLAG(s->u.mapping->flags,MAPPING_FLAG_WEAK,ret);    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");