source: trunk/src/binutils/bfd/hash.c@ 229

Last change on this file since 229 was 10, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 21.1 KB
Line 
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
6This file is part of BFD, the Binary File Descriptor library.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
20Foundation, 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/*
28SECTION
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