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.97 2000/08/07 09:47:47 grubba Exp $"); + RCSID("$Id: mapping.c,v 1.98 2000/08/11 13:20:44 grubba Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "error.h"   #include "pike_memory.h"   #include "dynamic_buffer.h"   #include "interpret.h"
pike.git/src/mapping.c:36:    struct mapping_data *md_=(M); \    if(md_->hardlinks) { md_->hardlinks--; md_->valrefs--; } \    free_mapping_data(M); \   }while(0)         #define MD_KEYPAIRS(MD, HSIZE) \    ( (struct keypair *)DO_ALIGN( (ptrdiff_t) (((struct mapping_data *)(MD))->hash + HSIZE), ALIGNOF(struct keypair)) )      #define MAPPING_DATA_SIZE(HSIZE, KEYPAIRS) \ -  (long)( MD_KEYPAIRS(0, HSIZE) + KEYPAIRS ) +  (ptrdiff_t)( MD_KEYPAIRS(0, HSIZE) + KEYPAIRS )            #undef EXIT_BLOCK   #define EXIT_BLOCK(m) \    INT32 e; \   DO_IF_DEBUG( \    if(m->refs) \    fatal("really free mapping on mapping with nonzero refs.\n"); \   ) \
pike.git/src/mapping.c:113:   static struct mapping_data empty_data = { 1, 1, 0,0,0,0,0 };      /* This function allocates the hash table and svalue space for a mapping    * struct. The size is the max number of indices that can fit in the    * allocated space.    */   static void init_mapping(struct mapping *m, INT32 size)   {    struct mapping_data *md;    char *tmp; -  INT32 e; +  ptrdiff_t e;    INT32 hashsize;       debug_malloc_touch(m);   #ifdef PIKE_DEBUG    if(size < 0) fatal("init_mapping with negative value.\n");   #endif    if(size)    {    hashsize=size / AVG_LINK_LENGTH + 1;    if(!(hashsize & 1)) hashsize++;
pike.git/src/mapping.c:343:      /*    * No need for super efficiency, should not be called very often    * -Hubbe    */   #define LOW_RELOC(X) X= (void *) ((char *)(X) + off);   #define RELOC(X) if(X) LOW_RELOC(X)      struct mapping_data *copy_mapping_data(struct mapping_data *md)   { -  long off,size,e; +  long e; +  ptrdiff_t size, off;    struct mapping_data *nmd;    struct keypair *keypairs;       debug_malloc_touch(md);       size=MAPPING_DATA_SIZE(md->hashsize, md->num_keypairs);       nmd=(struct mapping_data *)xalloc(size);    MEMCPY(nmd, md, size);    off=((char *)nmd) - ((char *)md);
pike.git/src/mapping.c:2094: Inside #if defined(PIKE_DEBUG)
   s=simple_free_buf();    fprintf(stderr,"%s\n",s);    free(s);   }         void debug_dump_mapping(struct mapping *m)   {    fprintf(stderr, "Refs=%d, flags=0x%x, next=%p, prev=%p",    m->refs, m->flags, m->next, m->prev); -  if (((int)m->data) & 3) { +  if (((ptrdiff_t)m->data) & 3) {    fprintf(stderr, ", data=%p (unaligned)\n", m->data);    } else {    fprintf(stderr, ", size=%d, hashsize=%d\n",    m->data->size, m->data->hashsize);    fprintf(stderr, "Indices type field = ");    debug_dump_type_field(m->data->ind_types);    fprintf(stderr, "\n");    fprintf(stderr, "Values type field = ");    debug_dump_type_field(m->data->val_types);    fprintf(stderr, "\n");