<html lang="en"> <head> <title>Traversing a Hash Table - Untitled</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Untitled"> <meta name="generator" content="makeinfo 4.7"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Hash-Tables.html#Hash-Tables" title="Hash Tables"> <link rel="prev" href="Looking-Up-or-Entering-a-String.html#Looking-Up-or-Entering-a-String" title="Looking Up or Entering a String"> <link rel="next" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type" title="Deriving a New Hash Table Type"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This file documents the BFD library. Copyright (C) 1991, 2000, 2001, 2003, 2006, 2007 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being ``GNU General Public License'' and ``Funding Free Software'', the Front-Cover texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled ``GNU Free Documentation License''. (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family: serif; font-weight: normal; } --></style> </head> <body> <div class="node"> <p> <a name="Traversing-a-Hash-Table"></a>Next: <a rel="next" accesskey="n" href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type">Deriving a New Hash Table Type</a>, Previous: <a rel="previous" accesskey="p" href="Looking-Up-or-Entering-a-String.html#Looking-Up-or-Entering-a-String">Looking Up or Entering a String</a>, Up: <a rel="up" accesskey="u" href="Hash-Tables.html#Hash-Tables">Hash Tables</a> <hr><br> </div> <h4 class="subsection">2.18.3 Traversing a hash table</h4> <p><a name="index-bfd_005fhash_005ftraverse-1389"></a>The function <code>bfd_hash_traverse</code> may be used to traverse a hash table, calling a function on each element. The traversal is done in a random order. <p><code>bfd_hash_traverse</code> takes as arguments a function and a generic <code>void *</code> pointer. The function is called with a hash table entry (a <code>struct bfd_hash_entry *</code>) and the generic pointer passed to <code>bfd_hash_traverse</code>. The function must return a <code>boolean</code> value, which indicates whether to continue traversing the hash table. If the function returns <code>FALSE</code>, <code>bfd_hash_traverse</code> will stop the traversal and return immediately. </body></html>