pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:1:   /*   || 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.   */ - #ifndef OLD_MAPPING + #ifdef PIKE_NEW_BLOCK_ALLOC      #include "nmapping.h"   #include "pike_error.h" -  + #if 0   #define EXPORT PMOD_EXPORT   #define ba_error Pike_error   #define round_up32_ ba_round_up32_   #define round_up32 ba_round_up32   #define cmemset ba_cmemset - #include "gjalloc/gjalloc.c" + #include "gjalloc.c"   #undef cmemset   #undef EXPORT   #undef round_up32_   #undef round_up32   #undef ba_error -  + #endif   #include "nmapping.c"      #else      #include "global.h"   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"
pike.git/src/mapping.c:1140:    return &k->val;    }    return 0;   }      PMOD_EXPORT struct keypair * mapping_lookup_random(const struct mapping * m) {    struct mapping_data *md=m->data;    size_t bucket, count;    struct keypair *k;    -  if(!m_sizeof(m)) -  SIMPLE_BAD_ARG_ERROR("random", 1, "mapping with elements in it"); -  +     /* Find a random, nonempty bucket */    bucket=my_rand() % md->hashsize;    while(! md->hash[bucket] )    if(++bucket > (size_t)md->hashsize)    bucket=0;       /* Count entries in bucket */    count=0;    for(k=md->hash[bucket];k;k=k->next) count++;   
pike.git/src/mapping.c:2545: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    }   }      #include "mapping_common.c"      #ifdef PIKE_DEBUG    - void simple_describe_mapping(struct mapping *m) - { -  dynamic_buffer save_buf; -  char *s; -  init_buf(&save_buf); -  describe_mapping(m,0,2); -  s=simple_free_buf(&save_buf); -  fprintf(stderr,"%s\n",s); -  free(s); - } -  -  +    void debug_dump_mapping(struct mapping *m)   {    fprintf(stderr, "Refs=%d, next=%p, prev=%p",    m->refs, m->next, m->prev);    if (((ptrdiff_t)m->data) & 3) {    fprintf(stderr, ", data=%p (unaligned)\n", m->data);    } else {    fprintf(stderr, ", flags=0x%x, size=%d, hashsize=%d\n",    m->data->flags, m->data->size, m->data->hashsize);    fprintf(stderr, "Indices type field =");