You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
4.9KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the BFD library.
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3 or
  7. any later version published by the Free Software Foundation; with the
  8. Invariant Sections being "GNU General Public License" and "Funding
  9. Free Software", the Front-Cover texts being (a) (see below), and with
  10. the Back-Cover Texts being (b) (see below). A copy of the license is
  11. included in the section entitled "GNU Free Documentation License".
  12. (a) The FSF's Front-Cover Text is:
  13. A GNU Manual
  14. (b) The FSF's Back-Cover Text is:
  15. You have freedom to copy and modify this GNU Manual, like GNU
  16. software. Copies published by the Free Software Foundation raise
  17. funds for GNU development. -->
  18. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <title>Looking Up or Entering a String (Untitled Document)</title>
  22. <meta name="description" content="Looking Up or Entering a String (Untitled Document)">
  23. <meta name="keywords" content="Looking Up or Entering a String (Untitled Document)">
  24. <meta name="resource-type" content="document">
  25. <meta name="distribution" content="global">
  26. <meta name="Generator" content="makeinfo">
  27. <link href="index.html#Top" rel="start" title="Top">
  28. <link href="BFD-Index.html#BFD-Index" rel="index" title="BFD Index">
  29. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  30. <link href="Hash-Tables.html#Hash-Tables" rel="up" title="Hash Tables">
  31. <link href="Traversing-a-Hash-Table.html#Traversing-a-Hash-Table" rel="next" title="Traversing a Hash Table">
  32. <link href="Creating-and-Freeing-a-Hash-Table.html#Creating-and-Freeing-a-Hash-Table" rel="prev" title="Creating and Freeing a Hash Table">
  33. <style type="text/css">
  34. <!--
  35. a.summary-letter {text-decoration: none}
  36. blockquote.indentedblock {margin-right: 0em}
  37. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  38. blockquote.smallquotation {font-size: smaller}
  39. div.display {margin-left: 3.2em}
  40. div.example {margin-left: 3.2em}
  41. div.lisp {margin-left: 3.2em}
  42. div.smalldisplay {margin-left: 3.2em}
  43. div.smallexample {margin-left: 3.2em}
  44. div.smalllisp {margin-left: 3.2em}
  45. kbd {font-style: oblique}
  46. pre.display {font-family: inherit}
  47. pre.format {font-family: inherit}
  48. pre.menu-comment {font-family: serif}
  49. pre.menu-preformatted {font-family: serif}
  50. pre.smalldisplay {font-family: inherit; font-size: smaller}
  51. pre.smallexample {font-size: smaller}
  52. pre.smallformat {font-family: inherit; font-size: smaller}
  53. pre.smalllisp {font-size: smaller}
  54. span.nolinebreak {white-space: nowrap}
  55. span.roman {font-family: initial; font-weight: normal}
  56. span.sansserif {font-family: sans-serif; font-weight: normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en">
  62. <a name="Looking-Up-or-Entering-a-String"></a>
  63. <div class="header">
  64. <p>
  65. 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> &nbsp; [<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>
  66. </div>
  67. <hr>
  68. <a name="Looking-up-or-entering-a-string"></a>
  69. <h4 class="subsection">2.18.2 Looking up or entering a string</h4>
  70. <a name="index-bfd_005fhash_005flookup"></a>
  71. <p>The function <code>bfd_hash_lookup</code> is used both to look up a
  72. string in the hash table and to create a new entry.
  73. </p>
  74. <p>If the <var>create</var> argument is <code>FALSE</code>, <code>bfd_hash_lookup</code>
  75. will look up a string. If the string is found, it will
  76. returns a pointer to a <code>struct bfd_hash_entry</code>. If the
  77. string is not found in the table <code>bfd_hash_lookup</code> will
  78. return <code>NULL</code>. You should not modify any of the fields in
  79. the returns <code>struct bfd_hash_entry</code>.
  80. </p>
  81. <p>If the <var>create</var> argument is <code>TRUE</code>, the string will be
  82. entered into the hash table if it is not already there.
  83. Either way a pointer to a <code>struct bfd_hash_entry</code> will be
  84. returned, either to the existing structure or to a newly
  85. created one. In this case, a <code>NULL</code> return means that an
  86. error occurred.
  87. </p>
  88. <p>If the <var>create</var> argument is <code>TRUE</code>, and a new entry is
  89. created, the <var>copy</var> argument is used to decide whether to
  90. copy the string onto the hash table objalloc or not. If
  91. <var>copy</var> is passed as <code>FALSE</code>, you must be careful not to
  92. deallocate or modify the string as long as the hash table
  93. exists.
  94. </p>
  95. </body>
  96. </html>