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.7 1996/11/14 01:36:29 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.8 1996/12/05 00:47:15 hubbe Exp $");   #include "main.h"   #include "types.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "macros.h"   #include "language.h"   #include "error.h"   #include "memory.h"   #include "dynamic_buffer.h"   #include "interpret.h"   #include "las.h"   #include "gc.h"    -  +    #define AVG_LINK_LENGTH 4   #define MIN_LINK_LENGTH 1   #define MAP_SLOTS(X) ((X)+((X)>>4)+8)   #define LOOP(m) for(e=0;e<m->hashsize;e++) for(k=m->hash[e];k;k=k->next)      struct keypair   {    struct keypair *next;    struct svalue ind, val;   };
pike.git/src/mapping.c:1041:    k->next=m->free_list;    m->hash[e]=0;    }    m->size=0;       next=m->next;       free_mapping(m);    }   } +  + void count_memory_in_mappings(INT32 *num_, INT32 *size_) + { +  INT32 num=0, size=0; +  struct mapping *m; +  for(m=first_mapping;m;m=m->next) +  { +  struct keypair *k; +  num++; +  size+=sizeof(struct mapping)+ +  sizeof(struct keypair *) * m->hashsize+ +  sizeof(struct keypair) * m->size; +  +  for(k=m->free_list;k;k=k->next) +  size+=sizeof(struct keypair); +  } +  +  *num_=num; +  *size_=size; + }