Branch: Tag:

2005-02-14

2005-02-14 15:54:59 by Martin Stjernholm <mast@lysator.liu.se>

Made array_set_flags more robust when the array is empty.

Rev: src/array.c:1.163

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.162 2004/09/22 18:00:48 nilsson Exp $ + || $Id: array.c,v 1.163 2005/02/14 15:54:59 mast Exp $   */      #include "global.h"
27:   #include "multiset.h"   #include "mapping.h"    - RCSID("$Id: array.c,v 1.162 2004/09/22 18:00:48 nilsson Exp $"); + RCSID("$Id: array.c,v 1.163 2005/02/14 15:54:59 mast Exp $");      PMOD_EXPORT struct array empty_array=   {
176:    a->flags = flags;    else {    free_array(a); -  switch (flags) { +  switch (flags & (ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK)) {    case 0:    add_ref(a = &empty_array); break;    case ARRAY_WEAK_FLAG:
2117:       if (!a->size) {    add_ref(&empty_array); -  return array_set_flags(&empty_array, a->flags & ~ARRAY_LVALUE); +  return array_set_flags(&empty_array, a->flags);    }       doing.next=p;