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.144 2001/12/01 23:50:04 mast Exp $"); + RCSID("$Id: mapping.c,v 1.145 2001/12/16 18:49:20 mast 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:1651:    for(e=0;p;e++,p=p->next)    {    if(p->pointer_a == (void *)m)    {    sprintf(buf,"@%ld",(long)e);    my_strcat(buf);    return;    }    }    +  if (Pike_in_gc) { +  /* Have to do without any temporary allocations. */ +  struct keypair *k; +  int notfirst = 0; +  +  if (m->data->size == 1) { +  my_strcat("([ /* 1 element */\n"); +  } else { +  sprintf(buf, "([ /* %ld elements */\n", (long)m->data->size); +  my_strcat(buf); +  } +  +  /* no mapping locking required (I hope) */ +  NEW_MAPPING_LOOP(m->data) { +  struct svalue *tmp; +  if (notfirst) my_strcat(",\n"); +  else notfirst = 1; +  for(d = 0; d < indent; d++) +  my_putchar(' '); +  describe_svalue(&k->ind, indent+2, &doing); +  my_putchar(':'); +  describe_svalue(&k->val, indent+2, &doing); +  } +  +  my_putchar('\n'); +  for(e=2; e<indent; e++) my_putchar(' '); +  my_strcat("])"); +  return; +  } +     a = mapping_indices(m);    SET_ONERROR(err, do_free_array, a);       if(! m->data->size) { /* mapping_indices may remove elements */    my_strcat("([ ])");    }    else {    int save_t_flag = t_flag;       if (m->data->size == 1) {