pike.git
/
src
/
mapping.h
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/mapping.h: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. \*/ /*
-
* $Id: mapping.h,v 1.
30
2000/
08/
09
12
:
49
:
28
grubba
Exp $
+
* $Id: mapping.h,v 1.
31
2000/
09
/
03
23
:
16
:
22
mast
Exp $
*/ #ifndef MAPPING_H #define MAPPING_H #include "las.h" #include "block_alloc_h.h" #define MAPPING_FLAG_WEAK 1 struct keypair
pike.git/src/mapping.h:23:
}; struct mapping_data { INT32 refs; INT32 valrefs; /* lock values too */ INT32 hardlinks; INT32 size, hashsize; INT32 num_keypairs; TYPE_FIELD ind_types, val_types;
+
INT16 flags;
struct keypair *free_list; struct keypair *hash[1 /* hashsize */ ]; /* struct keypair data_block[ hashsize * AVG_LINK_LENGTH ] */ };
-
+
#undef MAPPING_SIZE_DEBUG
+
/* This debug doesn't work with stealth_check_mapping_for_destruct and
+
* gc_recurse_weak_mapping. */
+
struct mapping { INT32 refs; #ifdef PIKE_SECURITY struct object *prot; #endif
-
#ifdef
PIKE
_DEBUG
+
#ifdef
MAPPING
_
SIZE_
DEBUG
INT32 debug_size; #endif
-
INT16 flags;
+
struct mapping_data *data; struct mapping *next, *prev; }; extern struct mapping *first_mapping; extern struct mapping *gc_internal_mapping; #define map_delete(m,key) map_delete_no_free(m, key, 0) #define m_sizeof(m) ((m)->data->size) #define m_ind_types(m) ((m)->data->ind_types) #define m_val_types(m) ((m)->data->val_types)
-
+
#define mapping_get_flags(m) ((m)->data->flags)
#define NEW_MAPPING_LOOP(md) \ for((e=0) DO_IF_DMALLOC( ?0:(debug_malloc_touch(md)) ) ;e<md->hashsize;e++) for(k=md->hash[e];k;k=k->next) /* WARNING: this should not be used */ #define MAPPING_LOOP(m) \ for((e=0) DO_IF_DMALLOC( ?0:(debug_malloc_touch(m),debug_malloc_touch(m->data))) ;e<m->data->hashsize;e++) for(k=m->data->hash[e];k;k=k->next) #define free_mapping(M) do{ struct mapping *m_=(M); debug_malloc_touch(m_); if(!--m_->refs) really_free_mapping(m_); }while(0)
pike.git/src/mapping.h:78:
PMOD_PROTO void really_free_mapping(struct mapping *md); /* Prototypes begin here */ BLOCK_ALLOC(mapping, 511) struct mapping *debug_allocate_mapping(int size); void really_free_mapping_data(struct mapping_data *md); void do_free_mapping(struct mapping *m); struct mapping_data *copy_mapping_data(struct mapping_data *md); void mapping_fix_type_field(struct mapping *m);
+
void mapping_set_flags(struct mapping *m, int flags);
void low_mapping_insert(struct mapping *m, struct svalue *key, struct svalue *val, int overwrite); void mapping_insert(struct mapping *m, struct svalue *key, struct svalue *val); union anything *mapping_get_item_ptr(struct mapping *m, struct svalue *key, TYPE_T t);