pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: mapping.c,v 1.137 2001/09/24 14:44:47 grubba Exp $"); + RCSID("$Id: mapping.c,v 1.138 2001/09/25 05:55:10 hubbe Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "pike_memory.h"   #include "dynamic_buffer.h"   #include "interpret.h"
pike.git/src/mapping.c:1719:      node *make_node_from_mapping(struct mapping *m)   {   #ifdef PIKE_DEBUG    if(m->data->refs <=0)    fatal("Zero refs in mapping->data\n");   #endif       mapping_fix_type_field(m);    -  if((m->data->ind_types | m->data->val_types) & (BIT_FUNCTION | BIT_OBJECT)) +  if(!mapping_is_constant(m,0))    {    struct array *ind, *val;    node *n;    ind=mapping_indices(m);    val=mapping_values(m);    n=mkefuncallnode("mkmapping",    mknode(F_ARG_LIST,    make_node_from_array(ind),    make_node_from_array(val)));    free_array(ind);
pike.git/src/mapping.c:2450: Inside #if defined(MAPPING_SIZE_DEBUG)
   md->size=0;   #ifdef MAPPING_SIZE_DEBUG    if(m->data ==md)    m->debug_size=0;   #endif       SET_NEXT_AND_FREE(m, free_mapping);    }   }    + int mapping_is_constant(struct mapping *m, +  struct processing *p) + { +  INT32 e; +  struct keypair *k; +  struct mapping_data *md=m->data; +  +  if( (md->ind_types | md->val_types) & ~(BIT_INT|BIT_FLOAT|BIT_STRING)) +  { +  md->valrefs++; +  add_ref(md); +  NEW_MAPPING_LOOP(md) +  { +  if(!svalues_are_constant(&k->ind, 1, md->ind_types, p)) return 0; +  if(!svalues_are_constant(&k->val, 1, md->val_types, p)) return 0; +  } +  md->valrefs--; +  free_mapping_data(md); +  } +  return 1; + }