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">
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <meta name="generator" content="Doxygen 1.8.9.1"/>
7 <title>json-c: linkhash.h File Reference</title>
8 <link href="tabs.css" rel="stylesheet" type="text/css"/>
9 <script type="text/javascript" src="jquery.js"></script>
10 <script type="text/javascript" src="dynsections.js"></script>
11 <link href="doxygen.css" rel="stylesheet" type="text/css" />
14 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
16 <table cellspacing="0" cellpadding="0">
18 <tr style="height: 56px;">
19 <td style="padding-left: 0.5em;">
20 <div id="projectname">json-c
21  <span id="projectnumber">0.12.1</span>
28 <!-- end header part -->
29 <!-- Generated by Doxygen 1.8.9.1 -->
30 <div id="navrow1" class="tabs">
32 <li><a href="index.html"><span>Main Page</span></a></li>
33 <li><a href="pages.html"><span>Related Pages</span></a></li>
34 <li><a href="annotated.html"><span>Data Structures</span></a></li>
35 <li class="current"><a href="files.html"><span>Files</span></a></li>
38 <div id="navrow2" class="tabs2">
40 <li><a href="files.html"><span>File List</span></a></li>
41 <li><a href="globals.html"><span>Globals</span></a></li>
47 <a href="#nested-classes">Data Structures</a> |
48 <a href="#define-members">Macros</a> |
49 <a href="#typedef-members">Typedefs</a> |
50 <a href="#func-members">Functions</a> </div>
51 <div class="headertitle">
52 <div class="title">linkhash.h File Reference</div> </div>
54 <div class="contents">
55 <table class="memberdecls">
56 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
57 Data Structures</h2></td></tr>
58 <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>
59 <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
60 <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>
61 <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
62 </table><table class="memberdecls">
63 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
65 <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>
66 <tr class="separator:a032f1bd115df254dda325437203ce5fb"><td class="memSeparator" colspan="2"> </td></tr>
67 <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>
68 <tr class="separator:a66b61772c29d85eb52b697e0b0dc0aaf"><td class="memSeparator" colspan="2"> </td></tr>
69 <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>
70 <tr class="separator:a93fad7f8ae44575dc89c9567859972d2"><td class="memSeparator" colspan="2"> </td></tr>
71 <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>
72 <tr class="separator:ac69428f2de0a6fb080b6fb373d506aa7"><td class="memSeparator" colspan="2"> </td></tr>
73 <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>
74 <tr class="separator:ad7dd67da915065dce2c6f44cb03e2d82"><td class="memSeparator" colspan="2"> </td></tr>
75 <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>
76 <tr class="separator:abcbb0df08b4976d0649b826b6bacfca1"><td class="memSeparator" colspan="2"> </td></tr>
77 </table><table class="memberdecls">
78 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
79 Typedefs</h2></td></tr>
80 <tr class="memitem:a0c6811f660b93857aafdbfdf80d9696b"><td class="memItemLeft" align="right" valign="top">typedef void( </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a0c6811f660b93857aafdbfdf80d9696b">lh_entry_free_fn</a>) (struct <a class="el" href="structlh__entry.html">lh_entry</a> *e)</td></tr>
81 <tr class="separator:a0c6811f660b93857aafdbfdf80d9696b"><td class="memSeparator" colspan="2"> </td></tr>
82 <tr class="memitem:a1780449146b716ad5e6ed0a0207d0417"><td class="memItemLeft" align="right" valign="top">typedef unsigned long( </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a1780449146b716ad5e6ed0a0207d0417">lh_hash_fn</a>) (const void *k)</td></tr>
83 <tr class="separator:a1780449146b716ad5e6ed0a0207d0417"><td class="memSeparator" colspan="2"> </td></tr>
84 <tr class="memitem:abcbf0e4849fb0c6279827ac3b66d15c3"><td class="memItemLeft" align="right" valign="top">typedef int( </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#abcbf0e4849fb0c6279827ac3b66d15c3">lh_equal_fn</a>) (const void *k1, const void *k2)</td></tr>
85 <tr class="separator:abcbf0e4849fb0c6279827ac3b66d15c3"><td class="memSeparator" colspan="2"> </td></tr>
86 </table><table class="memberdecls">
87 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
88 Functions</h2></td></tr>
89 <tr class="memitem:a2e560f0d3e5a20f6b0bfa4049737db23"><td class="memItemLeft" align="right" valign="top">unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a2e560f0d3e5a20f6b0bfa4049737db23">lh_ptr_hash</a> (const void *k)</td></tr>
90 <tr class="separator:a2e560f0d3e5a20f6b0bfa4049737db23"><td class="memSeparator" colspan="2"> </td></tr>
91 <tr class="memitem:a6ce3cb97560072c40f5caeaba85f756a"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a6ce3cb97560072c40f5caeaba85f756a">lh_ptr_equal</a> (const void *k1, const void *k2)</td></tr>
92 <tr class="separator:a6ce3cb97560072c40f5caeaba85f756a"><td class="memSeparator" colspan="2"> </td></tr>
93 <tr class="memitem:a1fcf495b9c4ce169630cb31f638b8435"><td class="memItemLeft" align="right" valign="top">unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a1fcf495b9c4ce169630cb31f638b8435">lh_char_hash</a> (const void *k)</td></tr>
94 <tr class="separator:a1fcf495b9c4ce169630cb31f638b8435"><td class="memSeparator" colspan="2"> </td></tr>
95 <tr class="memitem:ae4e9f21fb1a556c7a50c6b7ea61f2079"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#ae4e9f21fb1a556c7a50c6b7ea61f2079">lh_char_equal</a> (const void *k1, const void *k2)</td></tr>
96 <tr class="separator:ae4e9f21fb1a556c7a50c6b7ea61f2079"><td class="memSeparator" colspan="2"> </td></tr>
97 <tr class="memitem:ac3ba464ac43c083397b1f1d34f2ddf55"><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#ac3ba464ac43c083397b1f1d34f2ddf55">lh_table_new</a> (int size, const char *name, <a class="el" href="linkhash_8h.html#a0c6811f660b93857aafdbfdf80d9696b">lh_entry_free_fn</a> *free_fn, <a class="el" href="linkhash_8h.html#a1780449146b716ad5e6ed0a0207d0417">lh_hash_fn</a> *hash_fn, <a class="el" href="linkhash_8h.html#abcbf0e4849fb0c6279827ac3b66d15c3">lh_equal_fn</a> *equal_fn)</td></tr>
98 <tr class="separator:ac3ba464ac43c083397b1f1d34f2ddf55"><td class="memSeparator" colspan="2"> </td></tr>
99 <tr class="memitem:a0aaf11e11ee5b0925279a52eab04bc38"><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#a0aaf11e11ee5b0925279a52eab04bc38">lh_kchar_table_new</a> (int size, const char *name, <a class="el" href="linkhash_8h.html#a0c6811f660b93857aafdbfdf80d9696b">lh_entry_free_fn</a> *free_fn)</td></tr>
100 <tr class="separator:a0aaf11e11ee5b0925279a52eab04bc38"><td class="memSeparator" colspan="2"> </td></tr>
101 <tr class="memitem:a705513954267a16cc1d40a284a7c441e"><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#a705513954267a16cc1d40a284a7c441e">lh_kptr_table_new</a> (int size, const char *name, <a class="el" href="linkhash_8h.html#a0c6811f660b93857aafdbfdf80d9696b">lh_entry_free_fn</a> *free_fn)</td></tr>
102 <tr class="separator:a705513954267a16cc1d40a284a7c441e"><td class="memSeparator" colspan="2"> </td></tr>
103 <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>
104 <tr class="separator:a81653acf740cf8c9fe672e6cd16df0cf"><td class="memSeparator" colspan="2"> </td></tr>
105 <tr class="memitem:a22b897763cc34a98c21c7fe82d151004"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a22b897763cc34a98c21c7fe82d151004">lh_table_insert</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, void *k, const void *v)</td></tr>
106 <tr class="separator:a22b897763cc34a98c21c7fe82d151004"><td class="memSeparator" colspan="2"> </td></tr>
107 <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>
108 <tr class="separator:ad3b6ca2d967a6c3021ee6c39e014a918"><td class="memSeparator" colspan="2"> </td></tr>
109 <tr class="memitem:a849aa0ce9fe550c16ce81a215b1765ad"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a849aa0ce9fe550c16ce81a215b1765ad">THIS_FUNCTION_IS_DEPRECATED</a> (extern const void *lh_table_lookup(struct <a class="el" href="structlh__table.html">lh_table</a> *t, const void *k))</td></tr>
110 <tr class="separator:a849aa0ce9fe550c16ce81a215b1765ad"><td class="memSeparator" colspan="2"> </td></tr>
111 <tr class="memitem:a81c270bb0dd9d5c8a3e7ae20bc4d67f3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="json__object_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>
112 <tr class="separator:a81c270bb0dd9d5c8a3e7ae20bc4d67f3"><td class="memSeparator" colspan="2"> </td></tr>
113 <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>
114 <tr class="separator:ae5885a71c3457190fb1dc2d6e20dde3b"><td class="memSeparator" colspan="2"> </td></tr>
115 <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>
116 <tr class="separator:a2fed2c78f70d229edb2d00775ffe593c"><td class="memSeparator" colspan="2"> </td></tr>
117 <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>
118 <tr class="separator:ac9ba631c91fe80fb905f04c7cd526f2b"><td class="memSeparator" colspan="2"> </td></tr>
119 <tr class="memitem:a1294160fa0e80cee04cd745a401f43a4"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a1294160fa0e80cee04cd745a401f43a4">lh_abort</a> (const char *msg,...)</td></tr>
120 <tr class="separator:a1294160fa0e80cee04cd745a401f43a4"><td class="memSeparator" colspan="2"> </td></tr>
121 <tr class="memitem:a5322eccf3394af7dc1ebb22af8f8c562"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="linkhash_8h.html#a5322eccf3394af7dc1ebb22af8f8c562">lh_table_resize</a> (struct <a class="el" href="structlh__table.html">lh_table</a> *t, int new_size)</td></tr>
122 <tr class="separator:a5322eccf3394af7dc1ebb22af8f8c562"><td class="memSeparator" colspan="2"> </td></tr>
124 <h2 class="groupheader">Macro Definition Documentation</h2>
125 <a class="anchor" id="a93fad7f8ae44575dc89c9567859972d2"></a>
126 <div class="memitem">
127 <div class="memproto">
128 <table class="memname">
130 <td class="memname">#define LH_EMPTY   (void*)-1</td>
133 </div><div class="memdoc">
134 <p>sentinel pointer value for empty slots </p>
138 <a class="anchor" id="ad7dd67da915065dce2c6f44cb03e2d82"></a>
139 <div class="memitem">
140 <div class="memproto">
141 <table class="memname">
143 <td class="memname">#define lh_foreach</td>
145 <td class="paramtype"> </td>
146 <td class="paramname">table, </td>
149 <td class="paramkey"></td>
151 <td class="paramtype"> </td>
152 <td class="paramname">entry </td>
157 <td></td><td>   for(entry = table->head; entry; entry = entry->next)</td>
160 </div><div class="memdoc">
161 <p>Convenience list iterator. </p>
165 <a class="anchor" id="abcbb0df08b4976d0649b826b6bacfca1"></a>
166 <div class="memitem">
167 <div class="memproto">
168 <table class="memname">
170 <td class="memname">#define lh_foreach_safe</td>
172 <td class="paramtype"> </td>
173 <td class="paramname">table, </td>
176 <td class="paramkey"></td>
178 <td class="paramtype"> </td>
179 <td class="paramname">entry, </td>
182 <td class="paramkey"></td>
184 <td class="paramtype"> </td>
185 <td class="paramname">tmp </td>
190 <td></td><td>   for(entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp)</td>
193 </div><div class="memdoc">
194 <p>lh_foreach_safe allows calling of deletion routine while iterating. </p>
198 <a class="anchor" id="ac69428f2de0a6fb080b6fb373d506aa7"></a>
199 <div class="memitem">
200 <div class="memproto">
201 <table class="memname">
203 <td class="memname">#define LH_FREED   (void*)-2</td>
206 </div><div class="memdoc">
207 <p>sentinel pointer value for freed slots </p>
211 <a class="anchor" id="a66b61772c29d85eb52b697e0b0dc0aaf"></a>
212 <div class="memitem">
213 <div class="memproto">
214 <table class="memname">
216 <td class="memname">#define LH_LOAD_FACTOR   0.66</td>
219 </div><div class="memdoc">
220 <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>
224 <a class="anchor" id="a032f1bd115df254dda325437203ce5fb"></a>
225 <div class="memitem">
226 <div class="memproto">
227 <table class="memname">
229 <td class="memname">#define LH_PRIME   0x9e370001UL</td>
232 </div><div class="memdoc">
233 <p>golden prime used in hash functions </p>
237 <h2 class="groupheader">Typedef Documentation</h2>
238 <a class="anchor" id="a0c6811f660b93857aafdbfdf80d9696b"></a>
239 <div class="memitem">
240 <div class="memproto">
241 <table class="memname">
243 <td class="memname">typedef void( lh_entry_free_fn) (struct <a class="el" href="structlh__entry.html">lh_entry</a> *e)</td>
246 </div><div class="memdoc">
247 <p>callback function prototypes </p>
251 <a class="anchor" id="abcbf0e4849fb0c6279827ac3b66d15c3"></a>
252 <div class="memitem">
253 <div class="memproto">
254 <table class="memname">
256 <td class="memname">typedef int( lh_equal_fn) (const void *k1, const void *k2)</td>
259 </div><div class="memdoc">
260 <p>callback function prototypes </p>
264 <a class="anchor" id="a1780449146b716ad5e6ed0a0207d0417"></a>
265 <div class="memitem">
266 <div class="memproto">
267 <table class="memname">
269 <td class="memname">typedef unsigned long( lh_hash_fn) (const void *k)</td>
272 </div><div class="memdoc">
273 <p>callback function prototypes </p>
277 <h2 class="groupheader">Function Documentation</h2>
278 <a class="anchor" id="a1294160fa0e80cee04cd745a401f43a4"></a>
279 <div class="memitem">
280 <div class="memproto">
281 <table class="memname">
283 <td class="memname">void lh_abort </td>
285 <td class="paramtype">const char * </td>
286 <td class="paramname"><em>msg</em>, </td>
289 <td class="paramkey"></td>
291 <td class="paramtype"> </td>
292 <td class="paramname"><em>...</em> </td>
300 </div><div class="memdoc">
304 <a class="anchor" id="ae4e9f21fb1a556c7a50c6b7ea61f2079"></a>
305 <div class="memitem">
306 <div class="memproto">
307 <table class="memname">
309 <td class="memname">int lh_char_equal </td>
311 <td class="paramtype">const void * </td>
312 <td class="paramname"><em>k1</em>, </td>
315 <td class="paramkey"></td>
317 <td class="paramtype">const void * </td>
318 <td class="paramname"><em>k2</em> </td>
326 </div><div class="memdoc">
330 <a class="anchor" id="a1fcf495b9c4ce169630cb31f638b8435"></a>
331 <div class="memitem">
332 <div class="memproto">
333 <table class="memname">
335 <td class="memname">unsigned long lh_char_hash </td>
337 <td class="paramtype">const void * </td>
338 <td class="paramname"><em>k</em></td><td>)</td>
342 </div><div class="memdoc">
346 <a class="anchor" id="a0aaf11e11ee5b0925279a52eab04bc38"></a>
347 <div class="memitem">
348 <div class="memproto">
349 <table class="memname">
351 <td class="memname">struct <a class="el" href="structlh__table.html">lh_table</a>* lh_kchar_table_new </td>
353 <td class="paramtype">int </td>
354 <td class="paramname"><em>size</em>, </td>
357 <td class="paramkey"></td>
359 <td class="paramtype">const char * </td>
360 <td class="paramname"><em>name</em>, </td>
363 <td class="paramkey"></td>
365 <td class="paramtype"><a class="el" href="linkhash_8h.html#a0c6811f660b93857aafdbfdf80d9696b">lh_entry_free_fn</a> * </td>
366 <td class="paramname"><em>free_fn</em> </td>
374 </div><div class="memdoc">
375 <p>Convenience function to create a new linkhash table with char keys. </p><dl class="params"><dt>Parameters</dt><dd>
376 <table class="params">
377 <tr><td class="paramname">size</td><td>initial table size. </td></tr>
378 <tr><td class="paramname">name</td><td>table name. </td></tr>
379 <tr><td class="paramname">free_fn</td><td>callback function used to free memory for entries. </td></tr>
383 <dl class="section return"><dt>Returns</dt><dd>a pointer onto the linkhash table. </dd></dl>
387 <a class="anchor" id="a705513954267a16cc1d40a284a7c441e"></a>
388 <div class="memitem">
389 <div class="memproto">
390 <table class="memname">
392 <td class="memname">struct <a class="el" href="structlh__table.html">lh_table</a>* lh_kptr_table_new </td>
394 <td class="paramtype">int </td>
395 <td class="paramname"><em>size</em>, </td>
398 <td class="paramkey"></td>
400 <td class="paramtype">const char * </td>
401 <td class="paramname"><em>name</em>, </td>
404 <td class="paramkey"></td>
406 <td class="paramtype"><a class="el" href="linkhash_8h.html#a0c6811f660b93857aafdbfdf80d9696b">lh_entry_free_fn</a> * </td>
407 <td class="paramname"><em>free_fn</em> </td>
415 </div><div class="memdoc">
416 <p>Convenience function to create a new linkhash table with ptr keys. </p><dl class="params"><dt>Parameters</dt><dd>
417 <table class="params">
418 <tr><td class="paramname">size</td><td>initial table size. </td></tr>
419 <tr><td class="paramname">name</td><td>table name. </td></tr>
420 <tr><td class="paramname">free_fn</td><td>callback function used to free memory for entries. </td></tr>
424 <dl class="section return"><dt>Returns</dt><dd>a pointer onto the linkhash table. </dd></dl>
428 <a class="anchor" id="a6ce3cb97560072c40f5caeaba85f756a"></a>
429 <div class="memitem">
430 <div class="memproto">
431 <table class="memname">
433 <td class="memname">int lh_ptr_equal </td>
435 <td class="paramtype">const void * </td>
436 <td class="paramname"><em>k1</em>, </td>
439 <td class="paramkey"></td>
441 <td class="paramtype">const void * </td>
442 <td class="paramname"><em>k2</em> </td>
450 </div><div class="memdoc">
454 <a class="anchor" id="a2e560f0d3e5a20f6b0bfa4049737db23"></a>
455 <div class="memitem">
456 <div class="memproto">
457 <table class="memname">
459 <td class="memname">unsigned long lh_ptr_hash </td>
461 <td class="paramtype">const void * </td>
462 <td class="paramname"><em>k</em></td><td>)</td>
466 </div><div class="memdoc">
467 <p>Pre-defined hash and equality functions </p>
471 <a class="anchor" id="a2fed2c78f70d229edb2d00775ffe593c"></a>
472 <div class="memitem">
473 <div class="memproto">
474 <table class="memname">
476 <td class="memname">int lh_table_delete </td>
478 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td>
479 <td class="paramname"><em>t</em>, </td>
482 <td class="paramkey"></td>
484 <td class="paramtype">const void * </td>
485 <td class="paramname"><em>k</em> </td>
493 </div><div class="memdoc">
494 <p>Delete a record from the table. If a callback free function is provided then it is called for the for the item being deleted. </p><dl class="params"><dt>Parameters</dt><dd>
495 <table class="params">
496 <tr><td class="paramname">t</td><td>the table to delete from. </td></tr>
497 <tr><td class="paramname">k</td><td>a pointer to the key to delete. </td></tr>
501 <dl class="section return"><dt>Returns</dt><dd>0 if the item was deleted. </dd>
503 -1 if it was not found. </dd></dl>
507 <a class="anchor" id="ae5885a71c3457190fb1dc2d6e20dde3b"></a>
508 <div class="memitem">
509 <div class="memproto">
510 <table class="memname">
512 <td class="memname">int lh_table_delete_entry </td>
514 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td>
515 <td class="paramname"><em>t</em>, </td>
518 <td class="paramkey"></td>
520 <td class="paramtype">struct <a class="el" href="structlh__entry.html">lh_entry</a> * </td>
521 <td class="paramname"><em>e</em> </td>
529 </div><div class="memdoc">
530 <p>Delete a record from the table. If a callback free function is provided then it is called for the for the item being deleted. </p><dl class="params"><dt>Parameters</dt><dd>
531 <table class="params">
532 <tr><td class="paramname">t</td><td>the table to delete from. </td></tr>
533 <tr><td class="paramname">e</td><td>a pointer to the entry to delete. </td></tr>
537 <dl class="section return"><dt>Returns</dt><dd>0 if the item was deleted. </dd>
539 -1 if it was not found. </dd></dl>
543 <a class="anchor" id="a81653acf740cf8c9fe672e6cd16df0cf"></a>
544 <div class="memitem">
545 <div class="memproto">
546 <table class="memname">
548 <td class="memname">void lh_table_free </td>
550 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td>
551 <td class="paramname"><em>t</em></td><td>)</td>
555 </div><div class="memdoc">
556 <p>Free a linkhash table. If a callback free function is provided then it is called for all entries in the table. </p><dl class="params"><dt>Parameters</dt><dd>
557 <table class="params">
558 <tr><td class="paramname">t</td><td>table to free. </td></tr>
565 <a class="anchor" id="a22b897763cc34a98c21c7fe82d151004"></a>
566 <div class="memitem">
567 <div class="memproto">
568 <table class="memname">
570 <td class="memname">int lh_table_insert </td>
572 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td>
573 <td class="paramname"><em>t</em>, </td>
576 <td class="paramkey"></td>
578 <td class="paramtype">void * </td>
579 <td class="paramname"><em>k</em>, </td>
582 <td class="paramkey"></td>
584 <td class="paramtype">const void * </td>
585 <td class="paramname"><em>v</em> </td>
593 </div><div class="memdoc">
594 <p>Insert a record into the table. </p><dl class="params"><dt>Parameters</dt><dd>
595 <table class="params">
596 <tr><td class="paramname">t</td><td>the table to insert into. </td></tr>
597 <tr><td class="paramname">k</td><td>a pointer to the key to insert. </td></tr>
598 <tr><td class="paramname">v</td><td>a pointer to the value to insert. </td></tr>
605 <a class="anchor" id="ac9ba631c91fe80fb905f04c7cd526f2b"></a>
606 <div class="memitem">
607 <div class="memproto">
608 <table class="memname">
610 <td class="memname">int lh_table_length </td>
612 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td>
613 <td class="paramname"><em>t</em></td><td>)</td>
617 </div><div class="memdoc">
621 <a class="anchor" id="ad3b6ca2d967a6c3021ee6c39e014a918"></a>
622 <div class="memitem">
623 <div class="memproto">
624 <table class="memname">
626 <td class="memname">struct <a class="el" href="structlh__entry.html">lh_entry</a>* lh_table_lookup_entry </td>
628 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td>
629 <td class="paramname"><em>t</em>, </td>
632 <td class="paramkey"></td>
634 <td class="paramtype">const void * </td>
635 <td class="paramname"><em>k</em> </td>
643 </div><div class="memdoc">
644 <p>Lookup a record into the table. </p><dl class="params"><dt>Parameters</dt><dd>
645 <table class="params">
646 <tr><td class="paramname">t</td><td>the table to lookup </td></tr>
647 <tr><td class="paramname">k</td><td>a pointer to the key to lookup </td></tr>
651 <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>
655 <a class="anchor" id="a81c270bb0dd9d5c8a3e7ae20bc4d67f3"></a>
656 <div class="memitem">
657 <div class="memproto">
658 <table class="memname">
660 <td class="memname"><a class="el" href="json__object_8h.html#a81f02022906fafc71eb9197049f07f73">json_bool</a> lh_table_lookup_ex </td>
662 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td>
663 <td class="paramname"><em>t</em>, </td>
666 <td class="paramkey"></td>
668 <td class="paramtype">const void * </td>
669 <td class="paramname"><em>k</em>, </td>
672 <td class="paramkey"></td>
674 <td class="paramtype">void ** </td>
675 <td class="paramname"><em>v</em> </td>
683 </div><div class="memdoc">
684 <p>Lookup a record in the table </p><dl class="params"><dt>Parameters</dt><dd>
685 <table class="params">
686 <tr><td class="paramname">t</td><td>the table to lookup </td></tr>
687 <tr><td class="paramname">k</td><td>a pointer to the key to lookup </td></tr>
688 <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>
692 <dl class="section return"><dt>Returns</dt><dd>whether or not the key was found </dd></dl>
696 <a class="anchor" id="ac3ba464ac43c083397b1f1d34f2ddf55"></a>
697 <div class="memitem">
698 <div class="memproto">
699 <table class="memname">
701 <td class="memname">struct <a class="el" href="structlh__table.html">lh_table</a>* lh_table_new </td>
703 <td class="paramtype">int </td>
704 <td class="paramname"><em>size</em>, </td>
707 <td class="paramkey"></td>
709 <td class="paramtype">const char * </td>
710 <td class="paramname"><em>name</em>, </td>
713 <td class="paramkey"></td>
715 <td class="paramtype"><a class="el" href="linkhash_8h.html#a0c6811f660b93857aafdbfdf80d9696b">lh_entry_free_fn</a> * </td>
716 <td class="paramname"><em>free_fn</em>, </td>
719 <td class="paramkey"></td>
721 <td class="paramtype"><a class="el" href="linkhash_8h.html#a1780449146b716ad5e6ed0a0207d0417">lh_hash_fn</a> * </td>
722 <td class="paramname"><em>hash_fn</em>, </td>
725 <td class="paramkey"></td>
727 <td class="paramtype"><a class="el" href="linkhash_8h.html#abcbf0e4849fb0c6279827ac3b66d15c3">lh_equal_fn</a> * </td>
728 <td class="paramname"><em>equal_fn</em> </td>
736 </div><div class="memdoc">
737 <p>Create a new linkhash table. </p><dl class="params"><dt>Parameters</dt><dd>
738 <table class="params">
739 <tr><td class="paramname">size</td><td>initial table size. The table is automatically resized although this incurs a performance penalty. </td></tr>
740 <tr><td class="paramname">name</td><td>the table name. </td></tr>
741 <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>
742 <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>
743 <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>
747 <dl class="section return"><dt>Returns</dt><dd>a pointer onto the linkhash table. </dd></dl>
751 <a class="anchor" id="a5322eccf3394af7dc1ebb22af8f8c562"></a>
752 <div class="memitem">
753 <div class="memproto">
754 <table class="memname">
756 <td class="memname">void lh_table_resize </td>
758 <td class="paramtype">struct <a class="el" href="structlh__table.html">lh_table</a> * </td>
759 <td class="paramname"><em>t</em>, </td>
762 <td class="paramkey"></td>
764 <td class="paramtype">int </td>
765 <td class="paramname"><em>new_size</em> </td>
773 </div><div class="memdoc">
777 <a class="anchor" id="a849aa0ce9fe550c16ce81a215b1765ad"></a>
778 <div class="memitem">
779 <div class="memproto">
780 <table class="memname">
782 <td class="memname">THIS_FUNCTION_IS_DEPRECATED </td>
784 <td class="paramtype">extern const void * </td>
785 <td class="paramname"><em>lh_table_lookup</em>struct lh_table *t, const void *k</td><td>)</td>
789 </div><div class="memdoc">
790 <p>Lookup a record into the table </p><dl class="params"><dt>Parameters</dt><dd>
791 <table class="params">
792 <tr><td class="paramname">t</td><td>the table to lookup </td></tr>
793 <tr><td class="paramname">k</td><td>a pointer to the key to lookup </td></tr>
797 <dl class="section return"><dt>Returns</dt><dd>a pointer to the found value or NULL if it does not exist. </dd></dl>
798 <dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000002">Deprecated:</a></b></dt><dd>Use lh_table_lookup_ex instead. </dd></dl>
802 </div><!-- contents -->
803 <!-- start footer part -->
804 <hr class="footer"/><address class="footer"><small>
805 Generated on Tue Jun 7 2016 17:51:50 for json-c by  <a href="http://www.doxygen.org/index.html">
806 <img class="footer" src="doxygen.png" alt="doxygen"/>