1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 5 <meta http-equiv="X-UA-Compatible" content="IE=9"/> 6 <title>json-c: /home/erh/json-c-0.15/linkhash.h File Reference</title> 7 <link href="tabs.css" rel="stylesheet" type="text/css"/> 8 <script type="text/javascript" src="jquery.js"></script> 9 <script type="text/javascript" src="dynsections.js"></script> 10 <link href="doxygen.css" rel="stylesheet" type="text/css" /> 11 </head> 12 <body> 13 <div id="top"><!-- do not remove this div, it is closed by doxygen! --> 14 <div id="titlearea"> 15 <table cellspacing="0" cellpadding="0"> 16 <tbody> 17 <tr style="height: 56px;"> 18 <td style="padding-left: 0.5em;"> 19 <div id="projectname">json-c 20  <span id="projectnumber">0.15</span> 21 </div> 22 </td> 23 </tr> 24 </tbody> 25 </table> 26 </div> 27 <!-- end header part --> 28 <!-- Generated by Doxygen 1.8.2 --> 29 <div id="navrow1" class="tabs"> 30 <ul class="tablist"> 31 <li><a href="index.html"><span>Main Page</span></a></li> 32 <li><a href="pages.html"><span>Related Pages</span></a></li> 33 <li><a href="annotated.html"><span>Data Structures</span></a></li> 34 <li class="current"><a href="files.html"><span>Files</span></a></li> 35 </ul> 36 </div> 37 <div id="navrow2" class="tabs2"> 38 <ul class="tablist"> 39 <li><a href="files.html"><span>File List</span></a></li> 40 <li><a href="globals.html"><span>Globals</span></a></li> 41 </ul> 42 </div> 43 <div id="nav-path" class="navpath"> 44 <ul> 45 <li class="navelem"><a class="el" href="dir_71f13e590eb9d766c31051438785ada5.html">json-c-0.15</a></li> </ul> 46 </div> 47 </div><!-- top --> 48 <div class="header"> 49 <div class="summary"> 50 <a href="#nested-classes">Data Structures</a> | 51 <a href="#define-members">Macros</a> | 52 <a href="#typedef-members">Typedefs</a> | 53 <a href="#func-members">Functions</a> </div> 54 <div class="headertitle"> 55 <div class="title">linkhash.h File Reference</div> </div> 56 </div><!--header--> 57 <div class="contents"> 58 59 <p>Internal methods for working with json_type_object objects. Although this is exposed by the <a class="el" href="json__object_8h.html#a2caa52ae1863bd073444f3737138a4db">json_object_get_object()</a> function and within the <a class="el" href="structjson__object__iter.html">json_object_iter</a> type, it is not recommended for direct use. 60 <a href="#details">More...</a></p> 61 <table class="memberdecls"> 62 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> 63 Data Structures</h2></td></tr> 64 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structlh__entry.html">lh_entry</a></td></tr> 65 <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> 66 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structlh__table.html">lh_table</a></td></tr> 67 <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> 68 </table><table class="memberdecls"> 69 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> 70 Macros</h2></td></tr> 71 <tr class="memitem:a032f1bd115df254dda325437203ce5fb"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a032f1bd115df254dda325437203ce5fb">LH_PRIME</a>   0x9e370001UL</td></tr> 72 <tr class="separator:a032f1bd115df254dda325437203ce5fb"><td class="memSeparator" colspan="2"> </td></tr> 73 <tr class="memitem:a66b61772c29d85eb52b697e0b0dc0aaf"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a66b61772c29d85eb52b697e0b0dc0aaf">LH_LOAD_FACTOR</a>   0.66</td></tr> 74 <tr class="separator:a66b61772c29d85eb52b697e0b0dc0aaf"><td class="memSeparator" colspan="2"> </td></tr> 75 <tr class="memitem:a93fad7f8ae44575dc89c9567859972d2"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a93fad7f8ae44575dc89c9567859972d2">LH_EMPTY</a>   (void *)-1</td></tr> 76 <tr class="separator:a93fad7f8ae44575dc89c9567859972d2"><td class="memSeparator" colspan="2"> </td></tr> 77 <tr class="memitem:ac69428f2de0a6fb080b6fb373d506aa7"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#ac69428f2de0a6fb080b6fb373d506aa7">LH_FREED</a>   (void *)-2</td></tr> 78 <tr class="separator:ac69428f2de0a6fb080b6fb373d506aa7"><td class="memSeparator" colspan="2"> </td></tr> 79 <tr class="memitem:ac32e80138c5be6dd9b0483a9cbcc8799"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#ac32e80138c5be6dd9b0483a9cbcc8799">JSON_C_STR_HASH_DFLT</a>   0</td></tr> 80 <tr class="separator:ac32e80138c5be6dd9b0483a9cbcc8799"><td class="memSeparator" colspan="2"> </td></tr> 81 <tr class="memitem:a62316f34fd42941b97a8e9a6b6e68faa"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a62316f34fd42941b97a8e9a6b6e68faa">JSON_C_STR_HASH_PERLLIKE</a>   1</td></tr> 82 <tr class="separator:a62316f34fd42941b97a8e9a6b6e68faa"><td class="memSeparator" colspan="2"> </td></tr> 83 <tr class="memitem:ad7dd67da915065dce2c6f44cb03e2d82"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#ad7dd67da915065dce2c6f44cb03e2d82">lh_foreach</a>(table, entry)   for (entry = table->head; entry; entry = entry->next)</td></tr> 84 <tr class="separator:ad7dd67da915065dce2c6f44cb03e2d82"><td class="memSeparator" colspan="2"> </td></tr> 85 <tr class="memitem:abcbb0df08b4976d0649b826b6bacfca1"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#abcbb0df08b4976d0649b826b6bacfca1">lh_foreach_safe</a>(table, entry, tmp)   for (entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp)</td></tr> 86 <tr class="separator:abcbb0df08b4976d0649b826b6bacfca1"><td class="memSeparator" colspan="2"> </td></tr> 87 <tr class="memitem:a7579ce28b8366fc9b8656f14270aa3aa"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a7579ce28b8366fc9b8656f14270aa3aa">lh_entry_k</a>(entry)   _LH_UNCONST((entry)->k)</td></tr> 88 <tr class="separator:a7579ce28b8366fc9b8656f14270aa3aa"><td class="memSeparator" colspan="2"> </td></tr> 89 <tr class="memitem:a0d4052ccfd8c5d351a9c1d3ba07671b3"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a0d4052ccfd8c5d351a9c1d3ba07671b3">lh_entry_v</a>(entry)   _LH_UNCONST((entry)->v)</td></tr> 90 <tr class="separator:a0d4052ccfd8c5d351a9c1d3ba07671b3"><td class="memSeparator" colspan="2"> </td></tr> 91 </table><table class="memberdecls"> 92 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> 93 Typedefs</h2></td></tr> 94 <tr class="memitem:a671553d0ee3c2a123190ba0f8ed2b635"><td class="memItemLeft" align="right" valign="top">typedef void( </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a671553d0ee3c2a123190ba0f8ed2b635">lh_entry_free_fn</a> )(struct <a class="el" href="structlh__entry.html">lh_entry</a> *e)</td></tr> 95 <tr class="separator:a671553d0ee3c2a123190ba0f8ed2b635"><td class="memSeparator" colspan="2"> </td></tr> 96 <tr class="memitem:a38bae27995dcfb6ee3fb109a9be229b2"><td class="memItemLeft" align="right" valign="top">typedef unsigned long( </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a38bae27995dcfb6ee3fb109a9be229b2">lh_hash_fn</a> )(const void *k)</td></tr> 97 <tr class="separator:a38bae27995dcfb6ee3fb109a9be229b2"><td class="memSeparator" colspan="2"> </td></tr> 98 <tr class="memitem:a91fd85fc81b0c7c83c62f00e84729091"><td class="memItemLeft" align="right" valign="top">typedef int( </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a91fd85fc81b0c7c83c62f00e84729091">lh_equal_fn</a> )(const void *k1, const void *k2)</td></tr> 99 <tr class="separator:a91fd85fc81b0c7c83c62f00e84729091"><td class="memSeparator" colspan="2"> </td></tr> 100 <tr class="memitem:a766e90057496fc6712d6be0da180a21f"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structlh__table.html">lh_table</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a766e90057496fc6712d6be0da180a21f">lh_table</a></td></tr> 101 <tr class="separator:a766e90057496fc6712d6be0da180a21f"><td class="memSeparator" colspan="2"> </td></tr> 102 </table><table class="memberdecls"> 103 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> 104 Functions</h2></td></tr> 105 <tr class="memitem:ac8e1d61af44d9c0824d8c7980385bcd3"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#ac8e1d61af44d9c0824d8c7980385bcd3">json_global_set_string_hash</a> (const int h)</td></tr> 106 <tr class="separator:ac8e1d61af44d9c0824d8c7980385bcd3"><td class="memSeparator" colspan="2"> </td></tr> 107 <tr class="memitem:a9c4f8a71dbe4d3390d9f7adb331beb0e"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structlh__table.html">lh_table</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a9c4f8a71dbe4d3390d9f7adb331beb0e">lh_table_new</a> (int size, <a class="el" href="linkhash_8h.html#a671553d0ee3c2a123190ba0f8ed2b635">lh_entry_free_fn</a> *free_fn, <a class="el" href="linkhash_8h.html#a38bae27995dcfb6ee3fb109a9be229b2">lh_hash_fn</a> *hash_fn, <a class="el" href="linkhash_8h.html#a91fd85fc81b0c7c83c62f00e84729091">lh_equal_fn</a> *equal_fn)</td></tr> 108 <tr class="separator:a9c4f8a71dbe4d3390d9f7adb331beb0e"><td class="memSeparator" colspan="2"> </td></tr> 109 <tr class="memitem:a6bf630754affe92612639542a6c49c3f"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structlh__table.html">lh_table</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a6bf630754affe92612639542a6c49c3f">lh_kchar_table_new</a> (int size, <a class="el" href="linkhash_8h.html#a671553d0ee3c2a123190ba0f8ed2b635">lh_entry_free_fn</a> *free_fn)</td></tr> 110 <tr class="separator:a6bf630754affe92612639542a6c49c3f"><td class="memSeparator" colspan="2"> </td></tr> 111 <tr class="memitem:af8108563b961dbf5471fe2c0e51f40a5"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structlh__table.html">lh_table</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#af8108563b961dbf5471fe2c0e51f40a5">lh_kptr_table_new</a> (int size, <a class="el" href="linkhash_8h.html#a671553d0ee3c2a123190ba0f8ed2b635">lh_entry_free_fn</a> *free_fn)</td></tr> 112 <tr class="separator:af8108563b961dbf5471fe2c0e51f40a5"><td class="memSeparator" colspan="2"> </td></tr> 113 <tr class="memitem:a81653acf740cf8c9fe672e6cd16df0cf"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a81653acf740cf8c9fe672e6cd16df0cf">lh_table_free</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t)</td></tr> 114 <tr class="separator:a81653acf740cf8c9fe672e6cd16df0cf"><td class="memSeparator" colspan="2"> </td></tr> 115 <tr class="memitem:a86c0cd547be1e2c2486a73bd58e1352c"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a86c0cd547be1e2c2486a73bd58e1352c">lh_table_insert</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, const void *k, const void *v)</td></tr> 116 <tr class="separator:a86c0cd547be1e2c2486a73bd58e1352c"><td class="memSeparator" colspan="2"> </td></tr> 117 <tr class="memitem:a4558a9347a422e03a15b0b7a29b82dc3"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a4558a9347a422e03a15b0b7a29b82dc3">lh_table_insert_w_hash</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, const void *k, const void *v, const unsigned long h, const unsigned opts)</td></tr> 118 <tr class="separator:a4558a9347a422e03a15b0b7a29b82dc3"><td class="memSeparator" colspan="2"> </td></tr> 119 <tr class="memitem:ad3b6ca2d967a6c3021ee6c39e014a918"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structlh__entry.html">lh_entry</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#ad3b6ca2d967a6c3021ee6c39e014a918">lh_table_lookup_entry</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, const void *k)</td></tr> 120 <tr class="separator:ad3b6ca2d967a6c3021ee6c39e014a918"><td class="memSeparator" colspan="2"> </td></tr> 121 <tr class="memitem:a59ecaf34ef59280952f4459b2de63677"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structlh__entry.html">lh_entry</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a59ecaf34ef59280952f4459b2de63677">lh_table_lookup_entry_w_hash</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, const void *k, const unsigned long h)</td></tr> 122 <tr class="separator:a59ecaf34ef59280952f4459b2de63677"><td class="memSeparator" colspan="2"> </td></tr> 123 <tr class="memitem:a81c270bb0dd9d5c8a3e7ae20bc4d67f3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="json__types_8h.html#a81f02022906fafc71eb9197049f07f73">json_bool</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a81c270bb0dd9d5c8a3e7ae20bc4d67f3">lh_table_lookup_ex</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, const void *k, void **v)</td></tr> 124 <tr class="separator:a81c270bb0dd9d5c8a3e7ae20bc4d67f3"><td class="memSeparator" colspan="2"> </td></tr> 125 <tr class="memitem:ae5885a71c3457190fb1dc2d6e20dde3b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#ae5885a71c3457190fb1dc2d6e20dde3b">lh_table_delete_entry</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, struct <a class="el" href="structlh__entry.html">lh_entry</a> *e)</td></tr> 126 <tr class="separator:ae5885a71c3457190fb1dc2d6e20dde3b"><td class="memSeparator" colspan="2"> </td></tr> 127 <tr class="memitem:a2fed2c78f70d229edb2d00775ffe593c"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a2fed2c78f70d229edb2d00775ffe593c">lh_table_delete</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, const void *k)</td></tr> 128 <tr class="separator:a2fed2c78f70d229edb2d00775ffe593c"><td class="memSeparator" colspan="2"> </td></tr> 129 <tr class="memitem:ac9ba631c91fe80fb905f04c7cd526f2b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#ac9ba631c91fe80fb905f04c7cd526f2b">lh_table_length</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t)</td></tr> 130 <tr class="separator:ac9ba631c91fe80fb905f04c7cd526f2b"><td class="memSeparator" colspan="2"> </td></tr> 131 <tr class="memitem:a30c8414e31aeee7669acc938116d933f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a30c8414e31aeee7669acc938116d933f">lh_table_resize</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, int new_size)</td></tr> 132 <tr class="separator:a30c8414e31aeee7669acc938116d933f"><td class="memSeparator" colspan="2"> </td></tr> 133 </table> 134 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> 135 <div class="textblock"><p>Internal methods for working with json_type_object objects. Although this is exposed by the <a class="el" href="json__object_8h.html#a2caa52ae1863bd073444f3737138a4db">json_object_get_object()</a> function and within the <a class="el" href="structjson__object__iter.html">json_object_iter</a> type, it is not recommended for direct use. </p> 136 </div><h2 class="groupheader">Macro Definition Documentation</h2> 137 <a class="anchor" id="ac32e80138c5be6dd9b0483a9cbcc8799"></a> 138 <div class="memitem"> 139 <div class="memproto"> 140 <table class="memname"> 141 <tr> 142 <td class="memname">#define JSON_C_STR_HASH_DFLT   0</td> 143 </tr> 144 </table> 145 </div><div class="memdoc"> 146 <p>default string hash function </p> 147 148 </div> 149 </div> 150 <a class="anchor" id="a62316f34fd42941b97a8e9a6b6e68faa"></a> 151 <div class="memitem"> 152 <div class="memproto"> 153 <table class="memname"> 154 <tr> 155 <td class="memname">#define JSON_C_STR_HASH_PERLLIKE   1</td> 156 </tr> 157 </table> 158 </div><div class="memdoc"> 159 <p>perl-like string hash function </p> 160 161 </div> 162 </div> 163 <a class="anchor" id="a93fad7f8ae44575dc89c9567859972d2"></a> 164 <div class="memitem"> 165 <div class="memproto"> 166 <table class="memname"> 167 <tr> 168 <td class="memname">#define LH_EMPTY   (void *)-1</td> 169 </tr> 170 </table> 171 </div><div class="memdoc"> 172 <p>sentinel pointer value for empty slots </p> 173 174 </div> 175 </div> 176 <a class="anchor" id="a7579ce28b8366fc9b8656f14270aa3aa"></a> 177 <div class="memitem"> 178 <div class="memproto"> 179 <table class="memname"> 180 <tr> 181 <td class="memname">#define lh_entry_k</td> 182 <td>(</td> 183 <td class="paramtype"> </td> 184 <td class="paramname">entry</td><td>)</td> 185 <td>   _LH_UNCONST((entry)->k)</td> 186 </tr> 187 </table> 188 </div><div class="memdoc"> 189 <p>Return a non-const version of <a class="el" href="structlh__entry.html#a79d9f1ef0dc444e17105aaeaf167e22c">lh_entry.k</a>.</p> 190 <p><a class="el" href="structlh__entry.html#a79d9f1ef0dc444e17105aaeaf167e22c">lh_entry.k</a> is const to indicate and help ensure that linkhash itself doesn't modify it, but callers are allowed to do what they want with it. See also <a class="el" href="structlh__entry.html#a14f40cc124c32b03f81151ae7934d2e7">lh_entry.k_is_constant</a> </p> 191 192 </div> 193 </div> 194 <a class="anchor" id="a0d4052ccfd8c5d351a9c1d3ba07671b3"></a> 195 <div class="memitem"> 196 <div class="memproto"> 197 <table class="memname"> 198 <tr> 199 <td class="memname">#define lh_entry_v</td> 200 <td>(</td> 201 <td class="paramtype"> </td> 202 <td class="paramname">entry</td><td>)</td> 203 <td>   _LH_UNCONST((entry)->v)</td> 204 </tr> 205 </table> 206 </div><div class="memdoc"> 207 <p>Return a non-const version of <a class="el" href="structlh__entry.html#a1b676732ab2ad3eeaedf6ec60a6a0835">lh_entry.v</a>.</p> 208 <p>v is const to indicate and help ensure that linkhash itself doesn't modify it, but callers are allowed to do what they want with it. </p> 209 210 </div> 211 </div> 212 <a class="anchor" id="ad7dd67da915065dce2c6f44cb03e2d82"></a> 213 <div class="memitem"> 214 <div class="memproto"> 215 <table class="memname"> 216 <tr> 217 <td class="memname">#define lh_foreach</td> 218 <td>(</td> 219 <td class="paramtype"> </td> 220 <td class="paramname">table, </td> 221 </tr> 222 <tr> 223 <td class="paramkey"></td> 224 <td></td> 225 <td class="paramtype"> </td> 226 <td class="paramname">entry </td> 227 </tr> 228 <tr> 229 <td></td> 230 <td>)</td> 231 <td></td><td>   for (entry = table->head; entry; entry = entry->next)</td> 232 </tr> 233 </table> 234 </div><div class="memdoc"> 235 <p>Convenience list iterator. </p> 236 237 </div> 238 </div> 239 <a class="anchor" id="abcbb0df08b4976d0649b826b6bacfca1"></a> 240 <div class="memitem"> 241 <div class="memproto"> 242 <table class="memname"> 243 <tr> 244 <td class="memname">#define lh_foreach_safe</td> 245 <td>(</td> 246 <td class="paramtype"> </td> 247 <td class="paramname">table, </td> 248 </tr> 249 <tr> 250 <td class="paramkey"></td> 251 <td></td> 252 <td class="paramtype"> </td> 253 <td class="paramname">entry, </td> 254 </tr> 255 <tr> 256 <td class="paramkey"></td> 257 <td></td> 258 <td class="paramtype"> </td> 259 <td class="paramname">tmp </td> 260 </tr> 261 <tr> 262 <td></td> 263 <td>)</td> 264 <td></td><td>   for (entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp)</td> 265 </tr> 266 </table> 267 </div><div class="memdoc"> 268 <p>lh_foreach_safe allows calling of deletion routine while iterating.</p> 269 <dl class="params"><dt>Parameters</dt><dd> 270 <table class="params"> 271 <tr><td class="paramname">table</td><td>a struct <a class="el" href="structlh__table.html">lh_table</a> * to iterate over </td></tr> 272 <tr><td class="paramname">entry</td><td>a struct <a class="el" href="structlh__entry.html">lh_entry</a> * variable to hold each element </td></tr> 273 <tr><td class="paramname">tmp</td><td>a struct <a class="el" href="structlh__entry.html">lh_entry</a> * variable to hold a temporary pointer to the next element </td></tr> 274 </table> 275 </dd> 276 </dl> 277 278 </div> 279 </div> 280 <a class="anchor" id="ac69428f2de0a6fb080b6fb373d506aa7"></a> 281 <div class="memitem"> 282 <div class="memproto"> 283 <table class="memname"> 284 <tr> 285 <td class="memname">#define LH_FREED   (void *)-2</td> 286 </tr> 287 </table> 288 </div><div class="memdoc"> 289 <p>sentinel pointer value for freed slots </p> 290 291 </div> 292 </div> 293 <a class="anchor" id="a66b61772c29d85eb52b697e0b0dc0aaf"></a> 294 <div class="memitem"> 295 <div class="memproto"> 296 <table class="memname"> 297 <tr> 298 <td class="memname">#define LH_LOAD_FACTOR   0.66</td> 299 </tr> 300 </table> 301 </div><div class="memdoc"> 302 <p>The fraction of filled hash buckets until an insert will cause the table to be resized. This can range from just above 0 up to 1.0. </p> 303 304 </div> 305 </div> 306 <a class="anchor" id="a032f1bd115df254dda325437203ce5fb"></a> 307 <div class="memitem"> 308 <div class="memproto"> 309 <table class="memname"> 310 <tr> 311 <td class="memname">#define LH_PRIME   0x9e370001UL</td> 312 </tr> 313 </table> 314 </div><div class="memdoc"> 315 <p>golden prime used in hash functions </p> 316 317 </div> 318 </div> 319 <h2 class="groupheader">Typedef Documentation</h2> 320 <a class="anchor" id="a671553d0ee3c2a123190ba0f8ed2b635"></a> 321 <div class="memitem"> 322 <div class="memproto"> 323 <table class="memname"> 324 <tr> 325 <td class="memname">typedef void( lh_entry_free_fn)(struct <a class="el" href="structlh__entry.html">lh_entry</a> *e)</td> 326 </tr> 327 </table> 328 </div><div class="memdoc"> 329 <p>callback function prototypes </p> 330 331 </div> 332 </div> 333 <a class="anchor" id="a91fd85fc81b0c7c83c62f00e84729091"></a> 334 <div class="memitem"> 335 <div class="memproto"> 336 <table class="memname"> 337 <tr> 338 <td class="memname">typedef int( lh_equal_fn)(const void *k1, const void *k2)</td> 339 </tr> 340 </table> 341 </div><div class="memdoc"> 342 <p>callback function prototypes </p> 343 344 </div> 345 </div> 346 <a class="anchor" id="a38bae27995dcfb6ee3fb109a9be229b2"></a> 347 <div class="memitem"> 348 <div class="memproto"> 349 <table class="memname"> 350 <tr> 351 <td class="memname">typedef unsigned long( lh_hash_fn)(const void *k)</td> 352 </tr> 353 </table> 354 </div><div class="memdoc"> 355 <p>callback function prototypes </p> 356 357 </div> 358 </div> 359 <a class="anchor" id="a766e90057496fc6712d6be0da180a21f"></a> 360 <div class="memitem"> 361 <div class="memproto"> 362 <table class="memname"> 363 <tr> 364 <td class="memname">typedef struct <a class="el" href="structlh__table.html">lh_table</a> <a class="el" href="structlh__table.html">lh_table</a></td> 365 </tr> 366 </table> 367 </div><div class="memdoc"> 368 369 </div> 370 </div> 371 <h2 class="groupheader">Function Documentation</h2> 372 <a class="anchor" id="ac8e1d61af44d9c0824d8c7980385bcd3"></a> 373 <div class="memitem"> 374 <div class="memproto"> 375 <table class="memname"> 376 <tr> 377 <td class="memname">int json_global_set_string_hash </td> 378 <td>(</td> 379 <td class="paramtype">const int </td> 380 <td class="paramname"><em>h</em></td><td>)</td> 381 <td></td> 382 </tr> 383 </table> 384 </div><div class="memdoc"> 385 <p>This function sets the hash function to be used for strings. Must be one of the JSON_C_STR_HASH_* values. </p> 386 <dl class="section return"><dt>Returns</dt><dd>0 - ok, -1 if parameter was invalid </dd></dl> 387 388 </div> 389 </div> 390 <a class="anchor" id="a6bf630754affe92612639542a6c49c3f"></a> 391 <div class="memitem"> 392 <div class="memproto"> 393 <table class="mlabels"> 394 <tr> 395 <td class="mlabels-left"> 396 <table class="memname"> 397 <tr> 398 <td class="memname">struct <a class="el" href="structlh__table.html">lh_table</a>* lh_kchar_table_new </td> 399 <td>(</td> 400 <td class="paramtype">int </td> 401 <td class="paramname"><em>size</em>, </td> 402 </tr> 403 <tr> 404 <td class="paramkey"></td> 405 <td></td> 406 <td class="paramtype"><a class="el" href="linkhash_8h.html#a671553d0ee3c2a123190ba0f8ed2b635">lh_entry_free_fn</a> * </td> 407 <td class="paramname"><em>free_fn</em> </td> 408 </tr> 409 <tr> 410 <td></td> 411 <td>)</td> 412 <td></td><td></td> 413 </tr> 414 </table> 415 </td> 416 <td class="mlabels-right"> 417 <span class="mlabels"><span class="mlabel">read</span></span> </td> 418 </tr> 419 </table> 420 </div><div class="memdoc"> 421 <p>Convenience function to create a new linkhash table with char keys.</p> 422 <dl class="params"><dt>Parameters</dt><dd> 423 <table class="params"> 424 <tr><td class="paramname">size</td><td>initial table size. </td></tr> 425 <tr><td class="paramname">free_fn</td><td>callback function used to free memory for entries. </td></tr> 426 </table> 427 </dd> 428 </dl> 429 <dl class="section return"><dt>Returns</dt><dd>On success, a pointer to the new linkhash table is returned. On error, a null pointer is returned. </dd></dl> 430 431 </div> 432 </div> 433 <a class="anchor" id="af8108563b961dbf5471fe2c0e51f40a5"></a> 434 <div class="memitem"> 435 <div class="memproto"> 436 <table class="mlabels"> 437 <tr> 438 <td class="mlabels-left"> 439 <table class="memname"> 440 <tr> 441 <td class="memname">struct <a class="el" href="structlh__table.html">lh_table</a>* lh_kptr_table_new </td> 442 <td>(</td> 443 <td class="paramtype">int </td> 444 <td class="paramname"><em>size</em>, </td> 445 </tr> 446 <tr> 447 <td class="paramkey"></td> 448 <td></td> 449 <td class="paramtype"><a class="el" href="linkhash_8h.html#a671553d0ee3c2a123190ba0f8ed2b635">lh_entry_free_fn</a> * </td> 450 <td class="paramname"><em>free_fn</em> </td> 451 </tr> 452 <tr> 453 <td></td> 454 <td>)</td> 455 <td></td><td></td> 456 </tr> 457 </table> 458 </td> 459 <td class="mlabels-right"> 460 <span class="mlabels"><span class="mlabel">read</span></span> </td> 461 </tr> 462 </table> 463 </div><div class="memdoc"> 464 <p>Convenience function to create a new linkhash table with ptr keys.</p> 465 <dl class="params"><dt>Parameters</dt><dd> 466 <table class="params"> 467 <tr><td class="paramname">size</td><td>initial table size. </td></tr> 468 <tr><td class="paramname">free_fn</td><td>callback function used to free memory for entries. </td></tr> 469 </table> 470 </dd> 471 </dl> 472 <dl class="section return"><dt>Returns</dt><dd>On success, a pointer to the new linkhash table is returned. On error, a null pointer is returned. </dd></dl> 473 474 </div> 475 </div> 476 <a class="anchor" id="a2fed2c78f70d229edb2d00775ffe593c"></a> 477 <div class="memitem"> 478 <div class="memproto"> 479 <table class="memname"> 480 <tr> 481 <td class="memname">int lh_table_delete </td> 482 <td>(</td> 483 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 484 <td class="paramname"><em>t</em>, </td> 485 </tr> 486 <tr> 487 <td class="paramkey"></td> 488 <td></td> 489 <td class="paramtype">const void * </td> 490 <td class="paramname"><em>k</em> </td> 491 </tr> 492 <tr> 493 <td></td> 494 <td>)</td> 495 <td></td><td></td> 496 </tr> 497 </table> 498 </div><div class="memdoc"> 499 <p>Delete a record from the table.</p> 500 <p>If a callback free function is provided then it is called for the for the item being deleted. </p> 501 <dl class="params"><dt>Parameters</dt><dd> 502 <table class="params"> 503 <tr><td class="paramname">t</td><td>the table to delete from. </td></tr> 504 <tr><td class="paramname">k</td><td>a pointer to the key to delete. </td></tr> 505 </table> 506 </dd> 507 </dl> 508 <dl class="section return"><dt>Returns</dt><dd>0 if the item was deleted. </dd> 509 <dd> 510 -1 if it was not found. </dd></dl> 511 512 </div> 513 </div> 514 <a class="anchor" id="ae5885a71c3457190fb1dc2d6e20dde3b"></a> 515 <div class="memitem"> 516 <div class="memproto"> 517 <table class="memname"> 518 <tr> 519 <td class="memname">int lh_table_delete_entry </td> 520 <td>(</td> 521 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 522 <td class="paramname"><em>t</em>, </td> 523 </tr> 524 <tr> 525 <td class="paramkey"></td> 526 <td></td> 527 <td class="paramtype">struct <a class="el" href="structlh__entry.html">lh_entry</a> * </td> 528 <td class="paramname"><em>e</em> </td> 529 </tr> 530 <tr> 531 <td></td> 532 <td>)</td> 533 <td></td><td></td> 534 </tr> 535 </table> 536 </div><div class="memdoc"> 537 <p>Delete a record from the table.</p> 538 <p>If a callback free function is provided then it is called for the for the item being deleted. </p> 539 <dl class="params"><dt>Parameters</dt><dd> 540 <table class="params"> 541 <tr><td class="paramname">t</td><td>the table to delete from. </td></tr> 542 <tr><td class="paramname">e</td><td>a pointer to the entry to delete. </td></tr> 543 </table> 544 </dd> 545 </dl> 546 <dl class="section return"><dt>Returns</dt><dd>0 if the item was deleted. </dd> 547 <dd> 548 -1 if it was not found. </dd></dl> 549 550 </div> 551 </div> 552 <a class="anchor" id="a81653acf740cf8c9fe672e6cd16df0cf"></a> 553 <div class="memitem"> 554 <div class="memproto"> 555 <table class="memname"> 556 <tr> 557 <td class="memname">void lh_table_free </td> 558 <td>(</td> 559 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 560 <td class="paramname"><em>t</em></td><td>)</td> 561 <td></td> 562 </tr> 563 </table> 564 </div><div class="memdoc"> 565 <p>Free a linkhash table.</p> 566 <p>If a lh_entry_free_fn callback free function was provided then it is called for all entries in the table.</p> 567 <dl class="params"><dt>Parameters</dt><dd> 568 <table class="params"> 569 <tr><td class="paramname">t</td><td>table to free. </td></tr> 570 </table> 571 </dd> 572 </dl> 573 574 </div> 575 </div> 576 <a class="anchor" id="a86c0cd547be1e2c2486a73bd58e1352c"></a> 577 <div class="memitem"> 578 <div class="memproto"> 579 <table class="memname"> 580 <tr> 581 <td class="memname">int lh_table_insert </td> 582 <td>(</td> 583 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 584 <td class="paramname"><em>t</em>, </td> 585 </tr> 586 <tr> 587 <td class="paramkey"></td> 588 <td></td> 589 <td class="paramtype">const void * </td> 590 <td class="paramname"><em>k</em>, </td> 591 </tr> 592 <tr> 593 <td class="paramkey"></td> 594 <td></td> 595 <td class="paramtype">const void * </td> 596 <td class="paramname"><em>v</em> </td> 597 </tr> 598 <tr> 599 <td></td> 600 <td>)</td> 601 <td></td><td></td> 602 </tr> 603 </table> 604 </div><div class="memdoc"> 605 <p>Insert a record into the table.</p> 606 <dl class="params"><dt>Parameters</dt><dd> 607 <table class="params"> 608 <tr><td class="paramname">t</td><td>the table to insert into. </td></tr> 609 <tr><td class="paramname">k</td><td>a pointer to the key to insert. </td></tr> 610 <tr><td class="paramname">v</td><td>a pointer to the value to insert.</td></tr> 611 </table> 612 </dd> 613 </dl> 614 <dl class="section return"><dt>Returns</dt><dd>On success, <code>0</code> is returned. On error, a negative value is returned. </dd></dl> 615 616 </div> 617 </div> 618 <a class="anchor" id="a4558a9347a422e03a15b0b7a29b82dc3"></a> 619 <div class="memitem"> 620 <div class="memproto"> 621 <table class="memname"> 622 <tr> 623 <td class="memname">int lh_table_insert_w_hash </td> 624 <td>(</td> 625 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 626 <td class="paramname"><em>t</em>, </td> 627 </tr> 628 <tr> 629 <td class="paramkey"></td> 630 <td></td> 631 <td class="paramtype">const void * </td> 632 <td class="paramname"><em>k</em>, </td> 633 </tr> 634 <tr> 635 <td class="paramkey"></td> 636 <td></td> 637 <td class="paramtype">const void * </td> 638 <td class="paramname"><em>v</em>, </td> 639 </tr> 640 <tr> 641 <td class="paramkey"></td> 642 <td></td> 643 <td class="paramtype">const unsigned long </td> 644 <td class="paramname"><em>h</em>, </td> 645 </tr> 646 <tr> 647 <td class="paramkey"></td> 648 <td></td> 649 <td class="paramtype">const unsigned </td> 650 <td class="paramname"><em>opts</em> </td> 651 </tr> 652 <tr> 653 <td></td> 654 <td>)</td> 655 <td></td><td></td> 656 </tr> 657 </table> 658 </div><div class="memdoc"> 659 <p>Insert a record into the table using a precalculated key hash.</p> 660 <p>The hash h, which should be calculated with lh_get_hash() on k, is provided by the caller, to allow for optimization when multiple operations with the same key are known to be needed.</p> 661 <dl class="params"><dt>Parameters</dt><dd> 662 <table class="params"> 663 <tr><td class="paramname">t</td><td>the table to insert into. </td></tr> 664 <tr><td class="paramname">k</td><td>a pointer to the key to insert. </td></tr> 665 <tr><td class="paramname">v</td><td>a pointer to the value to insert. </td></tr> 666 <tr><td class="paramname">h</td><td>hash value of the key to insert </td></tr> 667 <tr><td class="paramname">opts</td><td>if set to JSON_C_OBJECT_KEY_IS_CONSTANT, sets <a class="el" href="structlh__entry.html#a14f40cc124c32b03f81151ae7934d2e7">lh_entry.k_is_constant</a> so t's free function knows to avoid freeing the key. </td></tr> 668 </table> 669 </dd> 670 </dl> 671 672 </div> 673 </div> 674 <a class="anchor" id="ac9ba631c91fe80fb905f04c7cd526f2b"></a> 675 <div class="memitem"> 676 <div class="memproto"> 677 <table class="memname"> 678 <tr> 679 <td class="memname">int lh_table_length </td> 680 <td>(</td> 681 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 682 <td class="paramname"><em>t</em></td><td>)</td> 683 <td></td> 684 </tr> 685 </table> 686 </div><div class="memdoc"> 687 688 </div> 689 </div> 690 <a class="anchor" id="ad3b6ca2d967a6c3021ee6c39e014a918"></a> 691 <div class="memitem"> 692 <div class="memproto"> 693 <table class="mlabels"> 694 <tr> 695 <td class="mlabels-left"> 696 <table class="memname"> 697 <tr> 698 <td class="memname">struct <a class="el" href="structlh__entry.html">lh_entry</a>* lh_table_lookup_entry </td> 699 <td>(</td> 700 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 701 <td class="paramname"><em>t</em>, </td> 702 </tr> 703 <tr> 704 <td class="paramkey"></td> 705 <td></td> 706 <td class="paramtype">const void * </td> 707 <td class="paramname"><em>k</em> </td> 708 </tr> 709 <tr> 710 <td></td> 711 <td>)</td> 712 <td></td><td></td> 713 </tr> 714 </table> 715 </td> 716 <td class="mlabels-right"> 717 <span class="mlabels"><span class="mlabel">read</span></span> </td> 718 </tr> 719 </table> 720 </div><div class="memdoc"> 721 <p>Lookup a record in the table.</p> 722 <dl class="params"><dt>Parameters</dt><dd> 723 <table class="params"> 724 <tr><td class="paramname">t</td><td>the table to lookup </td></tr> 725 <tr><td class="paramname">k</td><td>a pointer to the key to lookup </td></tr> 726 </table> 727 </dd> 728 </dl> 729 <dl class="section return"><dt>Returns</dt><dd>a pointer to the record structure of the value or NULL if it does not exist. </dd></dl> 730 731 </div> 732 </div> 733 <a class="anchor" id="a59ecaf34ef59280952f4459b2de63677"></a> 734 <div class="memitem"> 735 <div class="memproto"> 736 <table class="mlabels"> 737 <tr> 738 <td class="mlabels-left"> 739 <table class="memname"> 740 <tr> 741 <td class="memname">struct <a class="el" href="structlh__entry.html">lh_entry</a>* lh_table_lookup_entry_w_hash </td> 742 <td>(</td> 743 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 744 <td class="paramname"><em>t</em>, </td> 745 </tr> 746 <tr> 747 <td class="paramkey"></td> 748 <td></td> 749 <td class="paramtype">const void * </td> 750 <td class="paramname"><em>k</em>, </td> 751 </tr> 752 <tr> 753 <td class="paramkey"></td> 754 <td></td> 755 <td class="paramtype">const unsigned long </td> 756 <td class="paramname"><em>h</em> </td> 757 </tr> 758 <tr> 759 <td></td> 760 <td>)</td> 761 <td></td><td></td> 762 </tr> 763 </table> 764 </td> 765 <td class="mlabels-right"> 766 <span class="mlabels"><span class="mlabel">read</span></span> </td> 767 </tr> 768 </table> 769 </div><div class="memdoc"> 770 <p>Lookup a record in the table using a precalculated key hash.</p> 771 <p>The hash h, which should be calculated with lh_get_hash() on k, is provided by the caller, to allow for optimization when multiple operations with the same key are known to be needed.</p> 772 <dl class="params"><dt>Parameters</dt><dd> 773 <table class="params"> 774 <tr><td class="paramname">t</td><td>the table to lookup </td></tr> 775 <tr><td class="paramname">k</td><td>a pointer to the key to lookup </td></tr> 776 <tr><td class="paramname">h</td><td>hash value of the key to lookup </td></tr> 777 </table> 778 </dd> 779 </dl> 780 <dl class="section return"><dt>Returns</dt><dd>a pointer to the record structure of the value or NULL if it does not exist. </dd></dl> 781 782 </div> 783 </div> 784 <a class="anchor" id="a81c270bb0dd9d5c8a3e7ae20bc4d67f3"></a> 785 <div class="memitem"> 786 <div class="memproto"> 787 <table class="memname"> 788 <tr> 789 <td class="memname"><a class="el" href="json__types_8h.html#a81f02022906fafc71eb9197049f07f73">json_bool</a> lh_table_lookup_ex </td> 790 <td>(</td> 791 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 792 <td class="paramname"><em>t</em>, </td> 793 </tr> 794 <tr> 795 <td class="paramkey"></td> 796 <td></td> 797 <td class="paramtype">const void * </td> 798 <td class="paramname"><em>k</em>, </td> 799 </tr> 800 <tr> 801 <td class="paramkey"></td> 802 <td></td> 803 <td class="paramtype">void ** </td> 804 <td class="paramname"><em>v</em> </td> 805 </tr> 806 <tr> 807 <td></td> 808 <td>)</td> 809 <td></td><td></td> 810 </tr> 811 </table> 812 </div><div class="memdoc"> 813 <p>Lookup a record in the table.</p> 814 <dl class="params"><dt>Parameters</dt><dd> 815 <table class="params"> 816 <tr><td class="paramname">t</td><td>the table to lookup </td></tr> 817 <tr><td class="paramname">k</td><td>a pointer to the key to lookup </td></tr> 818 <tr><td class="paramname">v</td><td>a pointer to a where to store the found value (set to NULL if it doesn't exist). </td></tr> 819 </table> 820 </dd> 821 </dl> 822 <dl class="section return"><dt>Returns</dt><dd>whether or not the key was found </dd></dl> 823 824 </div> 825 </div> 826 <a class="anchor" id="a9c4f8a71dbe4d3390d9f7adb331beb0e"></a> 827 <div class="memitem"> 828 <div class="memproto"> 829 <table class="mlabels"> 830 <tr> 831 <td class="mlabels-left"> 832 <table class="memname"> 833 <tr> 834 <td class="memname">struct <a class="el" href="structlh__table.html">lh_table</a>* lh_table_new </td> 835 <td>(</td> 836 <td class="paramtype">int </td> 837 <td class="paramname"><em>size</em>, </td> 838 </tr> 839 <tr> 840 <td class="paramkey"></td> 841 <td></td> 842 <td class="paramtype"><a class="el" href="linkhash_8h.html#a671553d0ee3c2a123190ba0f8ed2b635">lh_entry_free_fn</a> * </td> 843 <td class="paramname"><em>free_fn</em>, </td> 844 </tr> 845 <tr> 846 <td class="paramkey"></td> 847 <td></td> 848 <td class="paramtype"><a class="el" href="linkhash_8h.html#a38bae27995dcfb6ee3fb109a9be229b2">lh_hash_fn</a> * </td> 849 <td class="paramname"><em>hash_fn</em>, </td> 850 </tr> 851 <tr> 852 <td class="paramkey"></td> 853 <td></td> 854 <td class="paramtype"><a class="el" href="linkhash_8h.html#a91fd85fc81b0c7c83c62f00e84729091">lh_equal_fn</a> * </td> 855 <td class="paramname"><em>equal_fn</em> </td> 856 </tr> 857 <tr> 858 <td></td> 859 <td>)</td> 860 <td></td><td></td> 861 </tr> 862 </table> 863 </td> 864 <td class="mlabels-right"> 865 <span class="mlabels"><span class="mlabel">read</span></span> </td> 866 </tr> 867 </table> 868 </div><div class="memdoc"> 869 <p>Create a new linkhash table.</p> 870 <dl class="params"><dt>Parameters</dt><dd> 871 <table class="params"> 872 <tr><td class="paramname">size</td><td>initial table size. The table is automatically resized although this incurs a performance penalty. </td></tr> 873 <tr><td class="paramname">free_fn</td><td>callback function used to free memory for entries when lh_table_free or lh_table_delete is called. If NULL is provided, then memory for keys and values must be freed by the caller. </td></tr> 874 <tr><td class="paramname">hash_fn</td><td>function used to hash keys. 2 standard ones are defined: lh_ptr_hash and lh_char_hash for hashing pointer values and C strings respectively. </td></tr> 875 <tr><td class="paramname">equal_fn</td><td>comparison function to compare keys. 2 standard ones defined: lh_ptr_hash and lh_char_hash for comparing pointer values and C strings respectively. </td></tr> 876 </table> 877 </dd> 878 </dl> 879 <dl class="section return"><dt>Returns</dt><dd>On success, a pointer to the new linkhash table is returned. On error, a null pointer is returned. </dd></dl> 880 881 </div> 882 </div> 883 <a class="anchor" id="a30c8414e31aeee7669acc938116d933f"></a> 884 <div class="memitem"> 885 <div class="memproto"> 886 <table class="memname"> 887 <tr> 888 <td class="memname">int lh_table_resize </td> 889 <td>(</td> 890 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td> 891 <td class="paramname"><em>t</em>, </td> 892 </tr> 893 <tr> 894 <td class="paramkey"></td> 895 <td></td> 896 <td class="paramtype">int </td> 897 <td class="paramname"><em>new_size</em> </td> 898 </tr> 899 <tr> 900 <td></td> 901 <td>)</td> 902 <td></td><td></td> 903 </tr> 904 </table> 905 </div><div class="memdoc"> 906 <p>Resizes the specified table.</p> 907 <dl class="params"><dt>Parameters</dt><dd> 908 <table class="params"> 909 <tr><td class="paramname">t</td><td>Pointer to table to resize. </td></tr> 910 <tr><td class="paramname">new_size</td><td>New table size. Must be positive.</td></tr> 911 </table> 912 </dd> 913 </dl> 914 <dl class="section return"><dt>Returns</dt><dd>On success, <code>0</code> is returned. On error, a negative value is returned. </dd></dl> 915 916 </div> 917 </div> 918 </div><!-- contents --> 919 <!-- start footer part --> 920 <hr class="footer"/><address class="footer"><small> 921 Generated on Sun Jul 26 2020 15:11:19 for json-c by  <a href="http://www.doxygen.org/index.html"> 922 <img class="footer" src="doxygen.png" alt="doxygen"/> 923 </a> 1.8.2 924 </small></address> 925 </body> 926 </html>
This page was automatically generated by LXR 0.3.1. • OpenWrt