|
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <!-- This file documents the BFD library.
-
- Copyright (C) 1991-2020 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.3 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. -->
- <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Looking Up or Entering a String (Untitled Document)</title>
-
- <meta name="description" content="Looking Up or Entering a String (Untitled Document)">
- <meta name="keywords" content="Looking Up or Entering a String (Untitled Document)">
- <meta name="resource-type" content="document">
- <meta name="distribution" content="global">
- <meta name="Generator" content="makeinfo">
- <link href="index.html#Top" rel="start" title="Top">
- <link href="BFD-Index.html#BFD-Index" rel="index" title="BFD Index">
- <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
- <link href="Hash-Tables.html#Hash-Tables" rel="up" title="Hash Tables">
- <link href="Traversing-a-Hash-Table.html#Traversing-a-Hash-Table" rel="next" title="Traversing a Hash Table">
- <link href="Creating-and-Freeing-a-Hash-Table.html#Creating-and-Freeing-a-Hash-Table" rel="prev" title="Creating and Freeing a Hash Table">
- <style type="text/css">
- <!--
- a.summary-letter {text-decoration: none}
- blockquote.indentedblock {margin-right: 0em}
- blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
- blockquote.smallquotation {font-size: smaller}
- div.display {margin-left: 3.2em}
- div.example {margin-left: 3.2em}
- div.lisp {margin-left: 3.2em}
- div.smalldisplay {margin-left: 3.2em}
- div.smallexample {margin-left: 3.2em}
- div.smalllisp {margin-left: 3.2em}
- kbd {font-style: oblique}
- pre.display {font-family: inherit}
- pre.format {font-family: inherit}
- pre.menu-comment {font-family: serif}
- pre.menu-preformatted {font-family: serif}
- pre.smalldisplay {font-family: inherit; font-size: smaller}
- pre.smallexample {font-size: smaller}
- pre.smallformat {font-family: inherit; font-size: smaller}
- pre.smalllisp {font-size: smaller}
- span.nolinebreak {white-space: nowrap}
- span.roman {font-family: initial; font-weight: normal}
- span.sansserif {font-family: sans-serif; font-weight: normal}
- ul.no-bullet {list-style: none}
- -->
- </style>
-
-
- </head>
-
- <body lang="en">
- <a name="Looking-Up-or-Entering-a-String"></a>
- <div class="header">
- <p>
- Next: <a href="Traversing-a-Hash-Table.html#Traversing-a-Hash-Table" accesskey="n" rel="next">Traversing a Hash Table</a>, Previous: <a href="Creating-and-Freeing-a-Hash-Table.html#Creating-and-Freeing-a-Hash-Table" accesskey="p" rel="prev">Creating and Freeing a Hash Table</a>, Up: <a href="Hash-Tables.html#Hash-Tables" accesskey="u" rel="up">Hash Tables</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p>
- </div>
- <hr>
- <a name="Looking-up-or-entering-a-string"></a>
- <h4 class="subsection">2.18.2 Looking up or entering a string</h4>
- <a name="index-bfd_005fhash_005flookup"></a>
- <p>The function <code>bfd_hash_lookup</code> is used both to look up a
- string in the hash table and to create a new entry.
- </p>
- <p>If the <var>create</var> argument is <code>FALSE</code>, <code>bfd_hash_lookup</code>
- will look up a string. If the string is found, it will
- returns a pointer to a <code>struct bfd_hash_entry</code>. If the
- string is not found in the table <code>bfd_hash_lookup</code> will
- return <code>NULL</code>. You should not modify any of the fields in
- the returns <code>struct bfd_hash_entry</code>.
- </p>
- <p>If the <var>create</var> argument is <code>TRUE</code>, the string will be
- entered into the hash table if it is not already there.
- Either way a pointer to a <code>struct bfd_hash_entry</code> will be
- returned, either to the existing structure or to a newly
- created one. In this case, a <code>NULL</code> return means that an
- error occurred.
- </p>
- <p>If the <var>create</var> argument is <code>TRUE</code>, and a new entry is
- created, the <var>copy</var> argument is used to decide whether to
- copy the string onto the hash table objalloc or not. If
- <var>copy</var> is passed as <code>FALSE</code>, you must be careful not to
- deallocate or modify the string as long as the hash table
- exists.
- </p>
-
-
-
- </body>
- </html>
|