Changeset 609 for branches/GNU/src/binutils/include/hashtab.h
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/include/hashtab.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* An expandable hash tables datatype. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.2 Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc. 3 3 Contributed by Vladimir Makarov (vmakarov@cygnus.com). 4 4 … … 37 37 #endif /* __cplusplus */ 38 38 39 #include <ansidecl.h> 39 #include "ansidecl.h" 40 41 #ifndef GTY 42 #define GTY(X) 43 #endif 40 44 41 45 /* The type for a hash code. */ … … 64 68 typedef int (*htab_trav) PARAMS ((void **, void *)); 65 69 70 /* Memory-allocation function, with the same functionality as calloc(). 71 Iff it returns NULL, the hash table implementation will pass an error 72 code back to the user, so if your code doesn't handle errors, 73 best if you use xcalloc instead. */ 74 typedef PTR (*htab_alloc) PARAMS ((size_t, size_t)); 75 76 /* We also need a free() routine. */ 77 typedef void (*htab_free) PARAMS ((PTR)); 78 79 /* Memory allocation and deallocation; variants which take an extra 80 argument. */ 81 typedef PTR (*htab_alloc_with_arg) PARAMS ((void *, size_t, size_t)); 82 typedef void (*htab_free_with_arg) PARAMS ((void *, void *)); 83 66 84 /* Hash tables are of the following type. The structure 67 85 (implementation) of this type is not needed for using the hash 68 86 tables. All work with hash table should be executed only through 69 functions mentioned below. */ 87 functions mentioned below. The size of this structure is subject to 88 change. */ 70 89 71 struct htab 90 struct htab GTY(()) 72 91 { 73 92 /* Pointer to hash function. */ … … 81 100 82 101 /* Table itself. */ 83 PTR * entries;102 PTR * GTY ((use_param (""), length ("%h.size"))) entries; 84 103 85 104 /* Current size (in entries) of the hash table */ … … 100 119 unsigned int collisions; 101 120 102 /* This is non-zero if we are allowed to return NULL for function calls 103 that allocate memory. */ 104 int return_allocation_failure; 121 /* Pointers to allocate/free functions. */ 122 htab_alloc alloc_f; 123 htab_free free_f; 124 125 /* Alternate allocate/free functions, which take an extra argument. */ 126 PTR GTY((skip (""))) alloc_arg; 127 htab_alloc_with_arg alloc_with_arg_f; 128 htab_free_with_arg free_with_arg_f; 105 129 }; 106 130 … … 112 136 /* The prototypes of the package functions. */ 113 137 114 extern htab_t htab_create PARAMS ((size_t, htab_hash, 115 htab_eq, htab_del)); 138 extern htab_t htab_create_alloc PARAMS ((size_t, htab_hash, 139 htab_eq, htab_del, 140 htab_alloc, htab_free)); 116 141 117 /* This function is like htab_create, but may return NULL if memory 118 allocation fails, and also signals that htab_find_slot_with_hash and 119 htab_find_slot are allowed to return NULL when inserting. */ 120 extern htab_t htab_try_create PARAMS ((size_t, htab_hash, 121 htab_eq, htab_del)); 142 extern htab_t htab_create_alloc_ex PARAMS ((size_t, htab_hash, 143 htab_eq, htab_del, 144 PTR, htab_alloc_with_arg, 145 htab_free_with_arg)); 146 147 /* Backward-compatibility functions. */ 148 extern htab_t htab_create PARAMS ((size_t, htab_hash, htab_eq, htab_del)); 149 extern htab_t htab_try_create PARAMS ((size_t, htab_hash, htab_eq, htab_del)); 150 151 extern void htab_set_functions_ex PARAMS ((htab_t, htab_hash, 152 htab_eq, htab_del, 153 PTR, htab_alloc_with_arg, 154 htab_free_with_arg)); 155 122 156 extern void htab_delete PARAMS ((htab_t)); 123 157 extern void htab_empty PARAMS ((htab_t)); … … 135 169 136 170 extern void htab_traverse PARAMS ((htab_t, htab_trav, void *)); 171 extern void htab_traverse_noresize PARAMS ((htab_t, htab_trav, void *)); 137 172 138 173 extern size_t htab_size PARAMS ((htab_t)); … … 146 181 extern htab_eq htab_eq_pointer; 147 182 183 /* A hash function for null-terminated strings. */ 184 extern hashval_t htab_hash_string PARAMS ((const PTR)); 185 148 186 #ifdef __cplusplus 149 187 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.