summaryrefslogtreecommitdiff
path: root/libiberty/hashtab.c
Commit message (Collapse)AuthorAgeFilesLines
* * hashtab.c: Include limits.h, stdint.h, ansidecl.h.rth2004-04-221-62/+171
| | | | | | | | | | | | | | | | (CHAR_BIT): Provide default. (struct prime_ent, prime_tab): New. (higher_prime_index): Rename from higher_prime_number, return index. (htab_mod_1): New. (htab_mod, htab_mod_m2): Use it. (htab_create_alloc, htab_create_alloc_ex): Store prime index. (htab_expand): Likewise. * configure.ac: Check for stdint.h. (UNSIGNED_64BIT_TYPE): New define and checks to fill it in. * config.in, configure: Rebuild. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81029 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_remove_elt_with_hash): New function.law2004-04-131-2/+16
| | | | | | | | | (htab_remove_elt): Implement in terms of htab_remove_elt_with_hash. * hashtab.h (htab_remove_elt_with_hash): Prototype new function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80641 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_size): Move to top of file; mark inline.rth2004-04-011-49/+71
| | | | | | | | | | | | | | (htab_elements): Likewise. (htab_mod, htab_mod_m2): New. (htab_delete): Refactor htab->size and htab->entries. (htab_empty): Likewise. (find_empty_slot_for_expand): Use htab_size, htab_mod, htab_mod_m2. (htab_find_with_hash, htab_find_slot_with_hash): Likewise. (htab_clear_slot): Use htab_size, htab_elements. (htab_traverse_noresize, htab_traverse): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80278 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_find_slot_with_hash): Decrease n_deletedzlomek2003-10-301-2/+2
| | | | | | | instead of increasing n_elements when inserting to deleted slot. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73090 138bc75d-0d04-0410-961f-82ee72b054a4
* * configure.in: Add check for malloc.h needed bydj2003-06-191-0/+4
| | | | | | | | | | | m68k for function free(). * configure: Regenerated. * config.in: Add HAVE_MALLOC_H. * hashtab.c: include malloc.h were available for free(). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68213 138bc75d-0d04-0410-961f-82ee72b054a4
* s/burtle/iterativejason2003-05-071-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66577 138bc75d-0d04-0410-961f-82ee72b054a4
* libiberty/jason2003-05-071-0/+138
| | | | | | | | | | | | | * hashtab.c (burtle_hash): New fn. * configure.in: Add AC_C_BIGENDIAN_CROSS. * aclocal.m4: Include accross.m4. * configure, config.in: Regenerate. include/ * hashtab.h (burtle_hash): Prototype. (burtle_hash_object): New macro. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66565 138bc75d-0d04-0410-961f-82ee72b054a4
* * argv.c: Fix comments.ghazi2003-04-151-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | * calloc.c: Don't unnecessarily include "libiberty.h". (bzero): Add prototype. * floatformat.c: Include "ansidecl.h", rely on ANSI_PROTOTYPES. * getcwd.c (getcwd): Use standard definition to avoid conflicts with system headers. * hashtab.c (htab_traverse): Delete unused variables. * rename.c: Include "ansidecl.h". (rename): Use standard definition to avoid conflicts with system headers. * strsignal.c: Rely on ANSI_PROTOTYPES. * strstr.c: Check GNUC >= 2, not GNUC == 2. * vfprintf.c: Include "ansidecl.h", rely on ANSI_PROTOTYPES. * vprintf.c: Include "ansidecl.h" earlier, rely on ANSI_PROTOTYPES. * vsprintf.c: Include "ansidecl.h" earlier, rely on ANSI_PROTOTYPES and possibly include <stdarg.h>. * Makefile.in: Regenerate dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65659 138bc75d-0d04-0410-961f-82ee72b054a4
* * ggc-common.c (ggc_mark_roots): Use htab_traverse_noresize.hubicka2003-03-171-4/+19
| | | | | | | | | | * hashtab.h (htab_traverse_noresize): Declare. * hashtab.c (htab_traverse_noresize): Break out from ... * hashtab.c (htab_traverse): ... here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64496 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_expand): Fix warning.hubicka2003-03-121-2/+2
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64249 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_expand): Compute the size of hashtable basedhubicka2003-03-121-3/+16
| | | | | | | | on the number of elements actually used. (htab_traverse): Call htab_expand when table is too empty. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64246 138bc75d-0d04-0410-961f-82ee72b054a4
* include/drow2003-01-261-2/+70
| | | | | | | | | | | | | | | * hashtab.h (htab_alloc_with_arg, htab_free_with_arg): Add new types. (struct htab): Add alloc_arg, alloc_with_arg_f, free_with_arg_f. (htab_create_alloc_ex): New prototype. (htab_set_functions_ex): New prototype. libiberty/ * hashtab.c (htab_create_alloc_ex): New function. (hatab_set_functions_ex): New function. (htab_delete, htab_expand): Support alternate allocation functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61820 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_expand): Fix allocation of new entries.zlomek2003-01-201-2/+4
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61507 138bc75d-0d04-0410-961f-82ee72b054a4
* Index: include/ChangeLoggeoffk2002-06-061-0/+23
| | | | | | | | | | | | | | * hashtab.h (htab_create): Restore prototype for backward compatibility. (htab_try_create): Likewise. Index: libiberty/ChangeLog * hashtab.c (htab_create): New stub function for backward compatibility. (htab_try_create): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54300 138bc75d-0d04-0410-961f-82ee72b054a4
* Merge from pch-branch up to tag pch-commit-20020603.geoffk2002-06-041-45/+22
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54232 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (higher_prime_number): Use 7 as minimum.rth2002-04-101-32/+46
| | | | | | | | (find_empty_slot_for_expand): Don't compute hash2 unless needed. (htab_find_slot_with_hash): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52099 138bc75d-0d04-0410-961f-82ee72b054a4
* include:ghazi2001-10-071-4/+4
| | | | | | | | | | | | | | | | | | | | * demangle.h (demangler_engine): Const-ify. * libiberty.h (buildargv): Likewise. libiberty: * argv.c (buildargv, tests, main): Const-ify. * cp-demangle.c (operator_code): Likewise. * cplus-dem.c (optable, libiberty_demanglers, cplus_demangle_set_style, cplus_demangle_name_to_style, print_demangler_list): Likewise. * hashtab.c (higher_prime_number): Likewise. * strcasecmp.c (charmap): Likewise. * strerror.c (error_info, strerror, main): Likewise. * strncasecmp.c (charmap): Likewise. * strsignal.c (signal_info): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46060 138bc75d-0d04-0410-961f-82ee72b054a4
* Add commentary.rth2001-08-171-1/+24
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44978 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_hash_string): New.rth2001-08-171-0/+16
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44950 138bc75d-0d04-0410-961f-82ee72b054a4
* fix typomeissner2001-03-151-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40517 138bc75d-0d04-0410-961f-82ee72b054a4
* Silence warningmeissner2001-03-151-39/+32
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40512 138bc75d-0d04-0410-961f-82ee72b054a4
* Silence warningmeissner2001-03-151-32/+40
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40511 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (higher_prime_number): Use a table, rather than ammitchel2000-11-271-22/+56
| | | | | | | seive, to find the next prime. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37775 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_expand): Change to return int. Use calloc orhp2000-11-041-8/+58
| | | | | | | | | | | | xcalloc depending on htab->return_allocation_failure. Return zero if calloc fails. (htab_create): Update comment to cover memory allocation. (htab_try_create): New. (htab_find_slot_with_hash): Return NULL if htab_expand fails. Update comment to cover this. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37247 138bc75d-0d04-0410-961f-82ee72b054a4
* (htab_create, htab_expand): Correct formatting of comment beforehp2000-11-031-36/+36
| | | | | | | function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37231 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c, partition.c, sort.c, xmemdup.c: Include string.hzack2000-05-291-0/+4
| | | | | | | | | | | | | | if HAVE_STRING_H. * pexecute.c, xexit.c: Include stdlib.h if HAVE_STDLIB_H. * objalloc.c: Include config.h. Include stdlib.h and don't declare malloc or free if HAVE_STDLIB_H. * strerror.c, strsignal.c: Include stdlib.h if HAVE_STDLIB_H, else declare malloc without prototype. Include string.h if HAVE_STRING_H, else declare memset without prototype. Don't include stddef.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34254 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (hash_pointer): Delete low-order bits which aremmitchel2000-05-161-1/+1
| | | | | | | probably zero, also eliminate a warning on alpha. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33934 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_expand): Add prototype.hubicka2000-04-271-0/+2
| | | | | | | (find_empty_slot_for_expand): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33487 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (hash_pointer, eq_pointer): Make definition static toghazi2000-04-241-3/+3
| | | | | | | | match prototype. (htab_expand): Cast the return value of xcalloc. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33391 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.h (hash_pointer): Declare.mmitchel2000-04-241-0/+27
| | | | | | | | | | | | (eq_pointer): Likewise. * hashtab.c (hash_pointer): New function. (eq_pointer): Likewise. (htab_hash_pointer): New variable. (htab_eq_pointer): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33372 138bc75d-0d04-0410-961f-82ee72b054a4
* * gcc/conflict.c (conflict_graph_add): Pass enum type tokenner2000-04-181-47/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | htab_find_slot. * gcc/cpperror.c (hashtab.h): Now include. * gcc/cppexp.c (hashtab.h): Likewise. * gcc/cpplex.c (hashtab.h): Likewise. * gcc/cppfiles.c (hashtab.h): Likewise. (find_include_file, _cpp_calc_hash, cpp_read_file): Pass enum type to htab_find_slot_with_hash. * gcc/cpphash.c (hashtab.h): Now include. (_cpp_lookup_slot): INSERT is now enum insert_option. * gcc/cpphash.h (_cpp_lookup_slot): Likewise. * gcc/cppinit.c (hashtab.h): Include earlier. (initialize_builtins): Pass enum to htab_find_slot. * gcc/cpplib.c (hashtab.h): Now include. (do_define, do_undef): Pass enum type to _cpp_lookup_slot. (do_pragma_poison, do_assert): Likewise. * gcc/emit-rtl.c (gen_rtx_CONST_INT): Pass enum to htab_find_slot_with_hash. * gcc/simplify-rtx.c (cselib_lookup_mem, cselib_lookup): Likewise. * gcc/tree.c (type_hash_add): Likewise. (build1): Minor cleanup. * include/hashtab.h (enum insert_option): New type. (htab_find_slot, htab_find_slot_with_hash): Use it. * libiberty/hashtab.c: Various minor cleanups. (htab_find_slot_with_hash): INSERT is now enum insert_option. (htab_find_slot): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33236 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.h (hashval_t): New type.mmitchel2000-03-311-7/+9
| | | | | | | | | | | | | (htab_find_with_hash): Use it as an argument. (htab_find_slot_with_hash): Likewise. * hashtab.c (find_empty_slot_for_expand): Use hashval_t for hash codes. (htab_find_with_hash): Likewise. (htab_find_slot_with_hash): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32842 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (htab_find_with_hash): Avoid calculating hash2zack2000-03-291-8/+16
| | | | | | | | | unless it will be used. Rearrange loop for better optimization. (higher_prime_number): Add static prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32809 138bc75d-0d04-0410-961f-82ee72b054a4
* Some cleanups/additions for hashtablescrux2000-03-141-8/+60
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32536 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.h (struct htab): Add del_f.zack2000-03-101-1/+26
| | | | | | | | | | | | (htab_del): New type. (htab_create): Add fourth argument. * hashtab.c (htab_create): Set del_f. (htab_delete, htab_empty, htab_remove_elt, htab_clear_slot): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32459 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c: Remove debugging variables (all_searches,zack2000-03-081-166/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | all_collisions, all_expansions). Delete all_hash_table_collisions. (create_hash_table, delete_hash_table, empty_hash_table, find_hash_table_entry, remove_element_from_hash_table_entry, clear_hash_table_slot, traverse_hash_table, hash_table_size, hash_table_elements_number, hash_table_collisions): Rename to: htab_create, htab_delete, htab_empty, htab_find_slot, htab_remove_elt, htab_clear_slot, htab_traverse, htab_size, htab_elements, htab_collisions. (htab_find): New function, handles common case where you don't plan to add or delete an entry. (htab_expand): Don't create a whole new table, just a new entry vector. (htab_find_slot): Simplify logic. * hashtab.h (hash_table_t): Rename to htab_t. (struct hash_table): Rename to struct htab. Shorten element names. Reorder elements by size. (htab_hash, htab_eq, htab_trav): New typedefs for the callback function pointers. (hash_table_entry_t): Discard; just use void * for element type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32437 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (sys/types.h): File included.law1999-11-281-0/+2
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30683 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c: Include stdio.h.law1999-11-101-0/+2
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30475 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtab.c (traverse_hash_table): Protect prototype with PARAMS.law1999-11-081-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30453 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-10-23 08:51 -0700 Zack Weinberg <zack@bitmover.com>zack1999-10-231-1/+36
| | | | | | | | | | | | | | | | * hashtab.c (find_hash_table_entry): When returning a DELETED_ENTRY slot, change it to EMPTY_ENTRY first. (clear_hash_table_slot): New function which deletes an entry by its position in the table, not its value. (traverse_hash_table): New function which calls a hook function for every live entry in the table. * hashtab.h: Give hash_table_t a struct tag. Add prototypes for clear_hash_table_slot and traverse_hash_table. Correct prototype of all_hash_table_collisions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30138 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.in (CFILES): Add hashtab.claw1999-10-151-0/+291
(REQUIRED_OFILES): Add hashtab.o (hashtab.o): Add dependencies. * hashtab.c: New file git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30012 138bc75d-0d04-0410-961f-82ee72b054a4