aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobody <>2003-02-02 23:00:07 +0000
committernobody <>2003-02-02 23:00:07 +0000
commitcddd45abf62af6ed70c8c67601a9f09da0a939b0 (patch)
treec8d60358c712fe334d27b9e65723fcea6351e33f /libiberty/hashtab.c
parentThis commit was manufactured by cvs2svn to create branch 'cagney- (diff)
downloadbinutils-gdb-interps-20030202-branchpoint.tar.gz
binutils-gdb-interps-20030202-branchpoint.tar.bz2
binutils-gdb-interps-20030202-branchpoint.zip
This commit was manufactured by cvs2svn to create branchinterps-20030202-branchpoint
'interps-20030202-branch'. Sprout from cagney-unwind-20030108-branch 2003-01-09 20:50:26 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'cagney-' Cherrypick from master 2003-02-02 23:00:06 UTC Alan Modra <amodra@gmail.com> 'daily update': ChangeLog Makefile.in Makefile.tpl bfd/ChangeLog bfd/Makefile.am bfd/Makefile.in bfd/aclocal.m4 bfd/archures.c bfd/bfd-in2.h bfd/bfd.c bfd/coffcode.h bfd/config.bfd bfd/cpu-sh.c bfd/elf-bfd.h bfd/elf.c bfd/elf32-i386.c bfd/elf32-mips.c bfd/elf32-ppc.c bfd/elf32-s390.c bfd/elf32-sh.c bfd/elf32-sh64-com.c bfd/elf32-sh64.c bfd/elf32-sh64.h bfd/elf32-sparc.c bfd/elf64-alpha.c bfd/elf64-mips.c bfd/elf64-mmix.c bfd/elf64-ppc.c bfd/elf64-s390.c bfd/elf64-sparc.c bfd/elfn32-mips.c bfd/elfxx-ia64.c bfd/elfxx-mips.c bfd/elfxx-mips.h bfd/elfxx-target.h bfd/libbfd.h bfd/opncls.c bfd/po/SRC-POTFILES.in bfd/reloc.c bfd/version.h config.if configure configure.in gdb/ChangeLog gdb/ChangeLog-2002 gdb/MAINTAINERS gdb/Makefile.in gdb/NEWS gdb/README gdb/acinclude.m4 gdb/aclocal.m4 gdb/ada-valprint.c gdb/alpha-nat.c gdb/alpha-tdep.c gdb/alpha-tdep.h gdb/ax-gdb.c gdb/blockframe.c gdb/breakpoint.c gdb/breakpoint.h gdb/buildsym.c gdb/c-exp.y gdb/c-valprint.c gdb/charset.c gdb/cli/cli-decode.h gdb/cli/cli-script.c gdb/complaints.c gdb/complaints.h gdb/config.in gdb/config/alpha/nm-linux.h gdb/config/djgpp/fnchange.lst gdb/config/h8500/tm-h8500.h gdb/config/i386/tm-ptx.h gdb/config/i386/tm-symmetry.h gdb/config/i386/xm-i386sco.h gdb/config/m68k/nm-apollo68b.h gdb/config/m68k/tm-sun3.h gdb/config/nm-lynx.h gdb/config/ns32k/nm-nbsd.h gdb/config/pa/tm-hppa.h gdb/config/pa/tm-hppa64.h gdb/config/sparc/tm-sp64.h gdb/config/sparc/tm-sparc.h gdb/configure gdb/configure.host gdb/configure.in gdb/configure.tgt gdb/corefile.c gdb/corelow.c gdb/cp-valprint.c gdb/cris-tdep.c gdb/d10v-tdep.c gdb/dbxread.c gdb/defs.h gdb/demangle.c gdb/disasm.c gdb/doc/ChangeLog gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/doc/stabs.texinfo gdb/dummy-frame.c gdb/dummy-frame.h gdb/dve3900-rom.c gdb/dwarf2cfi.c gdb/dwarf2read.c gdb/dwarfread.c gdb/elfread.c gdb/eval.c gdb/exec.c gdb/expprint.c gdb/expression.h gdb/f-exp.y gdb/f-typeprint.c gdb/f-valprint.c gdb/findvar.c gdb/frame-unwind.c gdb/frame-unwind.h gdb/frame.c gdb/frame.h gdb/gcore.c gdb/gdb-stabs.h gdb/gdb_dirent.h gdb/gdb_indent.sh gdb/gdb_mbuild.sh gdb/gdbarch.c gdb/gdbarch.h gdb/gdbarch.sh gdb/gdbcore.h gdb/gdbtypes.c gdb/gdbtypes.h gdb/gnu-v2-abi.c gdb/hppa-tdep.c gdb/hppab-nat.c gdb/hppah-nat.c gdb/hpread.c gdb/hpux-thread.c gdb/i386v-nat.c gdb/infcmd.c gdb/inferior.h gdb/infrun.c gdb/inftarg.c gdb/irix4-nat.c gdb/jv-typeprint.c gdb/language.c gdb/language.h gdb/lin-lwp.c gdb/linespec.c gdb/lynx-nat.c gdb/m32r-tdep.c gdb/m68klinux-nat.c gdb/main.c gdb/maint.c gdb/mdebugread.c gdb/mi/ChangeLog gdb/mi/gdbmi.texinfo gdb/mi/mi-cmd-env.c gdb/mi/mi-cmd-var.c gdb/mi/mi-main.c gdb/mips-nat.c gdb/mips-tdep.c gdb/mipsv4-nat.c gdb/mn10200-tdep.c gdb/monitor.c gdb/monitor.h gdb/objc-exp.y gdb/objfiles.c gdb/objfiles.h gdb/ocd.c gdb/parse.c gdb/proc-utils.h gdb/procfs.c gdb/remote-e7000.c gdb/remote-mips.c gdb/remote-sds.c gdb/remote-sim.c gdb/remote-vx.c gdb/rom68k-rom.c gdb/rs6000-nat.c gdb/scm-lang.c gdb/scm-lang.h gdb/sentinel-frame.c gdb/sentinel-frame.h gdb/ser-go32.c gdb/sh-tdep.c gdb/solib-svr4.c gdb/solib.c gdb/somread.c gdb/somsolib.c gdb/somsolib.h gdb/source.c gdb/sparc-tdep.c gdb/stabsread.c gdb/stabsread.h gdb/stack.c gdb/symfile.c gdb/symfile.h gdb/symmisc.c gdb/symtab.c gdb/symtab.h gdb/target.c gdb/target.h gdb/testsuite/ChangeLog gdb/testsuite/gdb.arch/altivec-abi.exp gdb/testsuite/gdb.arch/altivec-regs.exp gdb/testsuite/gdb.asm/arm.inc gdb/testsuite/gdb.asm/asm-source.exp gdb/testsuite/gdb.base/advance.c gdb/testsuite/gdb.base/advance.exp gdb/testsuite/gdb.base/args.c gdb/testsuite/gdb.base/args.exp gdb/testsuite/gdb.base/break.exp gdb/testsuite/gdb.base/constvars.exp gdb/testsuite/gdb.base/default.exp gdb/testsuite/gdb.base/display.exp gdb/testsuite/gdb.base/float.exp gdb/testsuite/gdb.base/help.exp gdb/testsuite/gdb.base/long_long.exp gdb/testsuite/gdb.base/mips_pro.exp gdb/testsuite/gdb.base/overlays.exp gdb/testsuite/gdb.base/printcmds.exp gdb/testsuite/gdb.base/relocate.exp gdb/testsuite/gdb.base/selftest.exp gdb/testsuite/gdb.base/setshow.exp gdb/testsuite/gdb.base/step-line.exp gdb/testsuite/gdb.base/step-test.exp gdb/testsuite/gdb.base/until.exp gdb/testsuite/gdb.c++/cplusfuncs.exp gdb/testsuite/gdb.c++/demangle.exp gdb/testsuite/gdb.c++/inherit.exp gdb/testsuite/gdb.c++/local.exp gdb/testsuite/gdb.c++/overload.exp gdb/testsuite/gdb.c++/printmethod.exp gdb/testsuite/gdb.c++/virtfunc.exp gdb/testsuite/gdb.mi/gdb669.exp gdb/testsuite/gdb.mi/gdb792.exp gdb/testsuite/gdb.mi/mi-console.exp gdb/testsuite/gdb.mi/mi-pthreads.exp gdb/testsuite/gdb.mi/mi-syn-frame.c gdb/testsuite/gdb.mi/mi-syn-frame.exp gdb/testsuite/gdb.mi/mi-var-child.exp gdb/testsuite/gdb.mi/mi-var-display.exp gdb/testsuite/gdb.mi/mi1-console.exp gdb/testsuite/gdb.mi/mi1-pthreads.exp gdb/testsuite/gdb.threads/killed.exp gdb/testsuite/lib/gdb.exp gdb/testsuite/lib/mi-support.exp gdb/thread-db.c gdb/thread.c gdb/top.c gdb/typeprint.c gdb/utils.c gdb/v850ice.c gdb/valarith.c gdb/valops.c gdb/value.h gdb/values.c gdb/version.in gdb/win32-nat.c gdb/x86-64-linux-nat.c gdb/x86-64-linux-tdep.c gdb/xcoffread.c gdb/z8k-tdep.c include/ChangeLog include/coff/ti.h include/coff/tic4x.h include/elf/ChangeLog include/elf/common.h include/elf/mips.h include/elf/ppc.h include/elf/ppc64.h include/elf/s390.h include/elf/sh.h include/elf/sparc.h include/hashtab.h include/opcode/ChangeLog include/opcode/hppa.h include/opcode/m68hc11.h include/splay-tree.h libiberty/ChangeLog libiberty/Makefile.in libiberty/configure libiberty/configure.in libiberty/functions.texi libiberty/hashtab.c libiberty/pex-common.h libiberty/pex-djgpp.c libiberty/pex-mpw.c libiberty/pex-msdos.c libiberty/pex-os2.c libiberty/pex-unix.c libiberty/pex-win32.c libiberty/pexecute.txh opcodes/ChangeLog opcodes/Makefile.am opcodes/Makefile.in opcodes/alpha-opc.c opcodes/po/POTFILES.in opcodes/sh-dis.c opcodes/sh-opc.h opcodes/sh64-dis.c opcodes/sparc-dis.c readline/ChangeLog.gdb readline/display.c sim/arm/ChangeLog sim/arm/README sim/h8300/ChangeLog sim/h8300/compile.c sim/mips/ChangeLog sim/mips/mips.igen Delete: gdb/a68v-nat.c gdb/config/i386/i386dgux.mh gdb/config/i386/i386mk.mh gdb/config/i386/i386mk.mt gdb/config/i386/i386v32.mh gdb/config/i386/tm-i386os9k.h gdb/config/i386/xm-i386v32.h gdb/config/m68k/es1800.mt gdb/hp300ux-nat.c gdb/mon960-rom.c gdb/nindy-share/Makefile gdb/nindy-share/Onindy.c gdb/nindy-share/README gdb/nindy-share/VERSION gdb/nindy-share/b.out.h gdb/nindy-share/block_io.h gdb/nindy-share/coff.h gdb/nindy-share/env.h gdb/nindy-share/nindy.c gdb/nindy-share/stop.h gdb/nindy-share/ttyflush.c gdb/nindy-tdep.c gdb/ptx4-nat.c gdb/remote-es.c gdb/saber.suppress libiberty/pexecute.c sim/arm/README.Cygnus
Diffstat (limited to 'libiberty/hashtab.c')
-rw-r--r--libiberty/hashtab.c76
1 files changed, 73 insertions, 3 deletions
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index 6bf59ff7378..0429936e961 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -1,5 +1,5 @@
/* An expandable hash tables datatype.
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
This file is part of the libiberty library.
@@ -191,6 +191,63 @@ htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f)
return result;
}
+/* As above, but use the variants of alloc_f and free_f which accept
+ an extra argument. */
+
+htab_t
+htab_create_alloc_ex (size, hash_f, eq_f, del_f, alloc_arg, alloc_f,
+ free_f)
+ size_t size;
+ htab_hash hash_f;
+ htab_eq eq_f;
+ htab_del del_f;
+ PTR alloc_arg;
+ htab_alloc_with_arg alloc_f;
+ htab_free_with_arg free_f;
+{
+ htab_t result;
+
+ size = higher_prime_number (size);
+ result = (htab_t) (*alloc_f) (alloc_arg, 1, sizeof (struct htab));
+ if (result == NULL)
+ return NULL;
+ result->entries = (PTR *) (*alloc_f) (alloc_arg, size, sizeof (PTR));
+ if (result->entries == NULL)
+ {
+ if (free_f != NULL)
+ (*free_f) (alloc_arg, result);
+ return NULL;
+ }
+ result->size = size;
+ result->hash_f = hash_f;
+ result->eq_f = eq_f;
+ result->del_f = del_f;
+ result->alloc_arg = alloc_arg;
+ result->alloc_with_arg_f = alloc_f;
+ result->free_with_arg_f = free_f;
+ return result;
+}
+
+/* Update the function pointers and allocation parameter in the htab_t. */
+
+void
+htab_set_functions_ex (htab, hash_f, eq_f, del_f, alloc_arg, alloc_f, free_f)
+ htab_t htab;
+ htab_hash hash_f;
+ htab_eq eq_f;
+ htab_del del_f;
+ PTR alloc_arg;
+ htab_alloc_with_arg alloc_f;
+ htab_free_with_arg free_f;
+{
+ htab->hash_f = hash_f;
+ htab->eq_f = eq_f;
+ htab->del_f = del_f;
+ htab->alloc_arg = alloc_arg;
+ htab->alloc_with_arg_f = alloc_f;
+ htab->free_with_arg_f = free_f;
+}
+
/* These functions exist solely for backward compatibility. */
#undef htab_create
@@ -234,6 +291,11 @@ htab_delete (htab)
(*htab->free_f) (htab->entries);
(*htab->free_f) (htab);
}
+ else if (htab->free_with_arg_f != NULL)
+ {
+ (*htab->free_with_arg_f) (htab->alloc_arg, htab->entries);
+ (*htab->free_with_arg_f) (htab->alloc_arg, htab);
+ }
}
/* This function clears all entries in the given hash table. */
@@ -306,16 +368,22 @@ htab_expand (htab)
PTR *olimit;
PTR *p;
PTR *nentries;
+ size_t nsize;
oentries = htab->entries;
olimit = oentries + htab->size;
- htab->size = higher_prime_number (htab->size * 2);
+ nsize = higher_prime_number (htab->size * 2);
- nentries = (PTR *) (*htab->alloc_f) (htab->size, sizeof (PTR *));
+ if (htab->alloc_with_arg_f != NULL)
+ nentries = (PTR *) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize,
+ sizeof (PTR *));
+ else
+ nentries = (PTR *) (*htab->alloc_f) (nsize, sizeof (PTR *));
if (nentries == NULL)
return 0;
htab->entries = nentries;
+ htab->size = nsize;
htab->n_elements -= htab->n_deleted;
htab->n_deleted = 0;
@@ -338,6 +406,8 @@ htab_expand (htab)
if (htab->free_f != NULL)
(*htab->free_f) (oentries);
+ else if (htab->free_with_arg_f != NULL)
+ (*htab->free_with_arg_f) (htab->alloc_arg, oentries);
return 1;
}