| 1 | /* hash.c -- hash table routines for BFD
|
|---|
| 2 | Copyright 1993, 1994, 1995, 1997, 1999, 2001
|
|---|
| 3 | Free Software Foundation, Inc.
|
|---|
| 4 | Written by Steve Chamberlain <[email protected]>
|
|---|
| 5 |
|
|---|
| 6 | This file is part of BFD, the Binary File Descriptor library.
|
|---|
| 7 |
|
|---|
| 8 | This program is free software; you can redistribute it and/or modify
|
|---|
| 9 | it under the terms of the GNU General Public License as published by
|
|---|
| 10 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 11 | (at your option) any later version.
|
|---|
| 12 |
|
|---|
| 13 | This program is distributed in the hope that it will be useful,
|
|---|
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 16 | GNU General Public License for more details.
|
|---|
| 17 |
|
|---|
| 18 | You should have received a copy of the GNU General Public License
|
|---|
| 19 | along with this program; if not, write to the Free Software
|
|---|
| 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|---|
| 21 |
|
|---|
| 22 | #include "bfd.h"
|
|---|
| 23 | #include "sysdep.h"
|
|---|
| 24 | #include "libbfd.h"
|
|---|
| 25 | #include "objalloc.h"
|
|---|
| 26 |
|
|---|
| 27 | /*
|
|---|
| 28 | SECTION
|
|---|
| 29 | Hash Tables
|
|---|
| 30 |
|
|---|
| 31 | @cindex Hash tables
|
|---|
| 32 | BFD provides a simple set of hash table functions. Routines
|
|---|
| 33 | are provided to initialize a hash table, to free a hash table,
|
|---|
| 34 | to look up a string in a hash table and optionally create an
|
|---|
| 35 | entry for it, and to traverse a hash table. There is
|
|---|
| 36 | currently no routine to delete an string from a hash table.
|
|---|
| 37 |
|
|---|
| 38 | The basic hash table does not permit any data to be stored
|
|---|
| 39 | with a string. However, a hash table is designed to present a
|
|---|
| 40 | base class from which other types of hash tables may be
|
|---|
| 41 | derived. These derived types may store additional information
|
|---|
| 42 | with the string. Hash tables were implemented in this way,
|
|---|
| 43 | rather than simply providing a data pointer in a hash table
|
|---|
| 44 | entry, because they were designed for use by the linker back
|
|---|
| 45 | ends. The linker may create thousands of hash table entries,
|
|---|
| 46 | and the overhead of allocating private data and storing and
|
|---|
|
|---|