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/arraylist.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">arraylist.h File Reference</div> </div> 56 </div><!--header--> 57 <div class="contents"> 58 59 <p>Internal methods for working with json_type_array objects. Although this is exposed by the <a class="el" href="json__object_8h.html#a23d20e3f886c1638a7116be66b7b5ec2">json_object_get_array()</a> method, 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="structarray__list.html">array_list</a></td></tr> 65 <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> 66 </table><table class="memberdecls"> 67 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> 68 Macros</h2></td></tr> 69 <tr class="memitem:acd30d910b398421574eb1f59e78617f5"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#acd30d910b398421574eb1f59e78617f5">ARRAY_LIST_DEFAULT_SIZE</a>   32</td></tr> 70 <tr class="separator:acd30d910b398421574eb1f59e78617f5"><td class="memSeparator" colspan="2"> </td></tr> 71 </table><table class="memberdecls"> 72 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> 73 Typedefs</h2></td></tr> 74 <tr class="memitem:aad83e4ed3c8ea274e6f18459276d774b"><td class="memItemLeft" align="right" valign="top">typedef void( </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#aad83e4ed3c8ea274e6f18459276d774b">array_list_free_fn</a> )(void *data)</td></tr> 75 <tr class="separator:aad83e4ed3c8ea274e6f18459276d774b"><td class="memSeparator" colspan="2"> </td></tr> 76 <tr class="memitem:a6d6d32d8b026ea2025df519b9e90f44a"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structarray__list.html">array_list</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a6d6d32d8b026ea2025df519b9e90f44a">array_list</a></td></tr> 77 <tr class="separator:a6d6d32d8b026ea2025df519b9e90f44a"><td class="memSeparator" colspan="2"> </td></tr> 78 </table><table class="memberdecls"> 79 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> 80 Functions</h2></td></tr> 81 <tr class="memitem:a0d4bfac055dfd98e17296142abf4d894"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structarray__list.html">array_list</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a0d4bfac055dfd98e17296142abf4d894">array_list_new</a> (<a class="el" href="arraylist_8h.html#aad83e4ed3c8ea274e6f18459276d774b">array_list_free_fn</a> *free_fn)</td></tr> 82 <tr class="separator:a0d4bfac055dfd98e17296142abf4d894"><td class="memSeparator" colspan="2"> </td></tr> 83 <tr class="memitem:ae3e43dc68f5d1815f3aaa36916602e45"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structarray__list.html">array_list</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#ae3e43dc68f5d1815f3aaa36916602e45">array_list_new2</a> (<a class="el" href="arraylist_8h.html#aad83e4ed3c8ea274e6f18459276d774b">array_list_free_fn</a> *free_fn, int initial_size)</td></tr> 84 <tr class="separator:ae3e43dc68f5d1815f3aaa36916602e45"><td class="memSeparator" colspan="2"> </td></tr> 85 <tr class="memitem:acd00fb70f7ca82f23b48b812c3498f67"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#acd00fb70f7ca82f23b48b812c3498f67">array_list_free</a> (struct <a class="el" href="structarray__list.html">array_list</a> *al)</td></tr> 86 <tr class="separator:acd00fb70f7ca82f23b48b812c3498f67"><td class="memSeparator" colspan="2"> </td></tr> 87 <tr class="memitem:a114f1af5b20b76a3dbb2d1d055006df8"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a114f1af5b20b76a3dbb2d1d055006df8">array_list_get_idx</a> (struct <a class="el" href="structarray__list.html">array_list</a> *al, size_t i)</td></tr> 88 <tr class="separator:a114f1af5b20b76a3dbb2d1d055006df8"><td class="memSeparator" colspan="2"> </td></tr> 89 <tr class="memitem:a9f92076e9d8229f8a07e536dc286f811"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a9f92076e9d8229f8a07e536dc286f811">array_list_put_idx</a> (struct <a class="el" href="structarray__list.html">array_list</a> *al, size_t i, void *data)</td></tr> 90 <tr class="separator:a9f92076e9d8229f8a07e536dc286f811"><td class="memSeparator" colspan="2"> </td></tr> 91 <tr class="memitem:a6e995608aa464244ff3184fb43574dc8"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a6e995608aa464244ff3184fb43574dc8">array_list_add</a> (struct <a class="el" href="structarray__list.html">array_list</a> *al, void *data)</td></tr> 92 <tr class="separator:a6e995608aa464244ff3184fb43574dc8"><td class="memSeparator" colspan="2"> </td></tr> 93 <tr class="memitem:aa3bf90f47aa210032304b14e7ad09ef7"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#aa3bf90f47aa210032304b14e7ad09ef7">array_list_length</a> (struct <a class="el" href="structarray__list.html">array_list</a> *al)</td></tr> 94 <tr class="separator:aa3bf90f47aa210032304b14e7ad09ef7"><td class="memSeparator" colspan="2"> </td></tr> 95 <tr class="memitem:afb67cc8e2e5c9be41c3e644536079169"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#afb67cc8e2e5c9be41c3e644536079169">array_list_sort</a> (struct <a class="el" href="structarray__list.html">array_list</a> *arr, int(*compar)(const void *, const void *))</td></tr> 96 <tr class="separator:afb67cc8e2e5c9be41c3e644536079169"><td class="memSeparator" colspan="2"> </td></tr> 97 <tr class="memitem:ac5d066b971fee72ce80084c1694109e3"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#ac5d066b971fee72ce80084c1694109e3">array_list_bsearch</a> (const void **key, struct <a class="el" href="structarray__list.html">array_list</a> *arr, int(*compar)(const void *, const void *))</td></tr> 98 <tr class="separator:ac5d066b971fee72ce80084c1694109e3"><td class="memSeparator" colspan="2"> </td></tr> 99 <tr class="memitem:aecedd8601ee96e2fd8eff5d83fda89ab"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#aecedd8601ee96e2fd8eff5d83fda89ab">array_list_del_idx</a> (struct <a class="el" href="structarray__list.html">array_list</a> *arr, size_t idx, size_t count)</td></tr> 100 <tr class="separator:aecedd8601ee96e2fd8eff5d83fda89ab"><td class="memSeparator" colspan="2"> </td></tr> 101 <tr class="memitem:aff21b2a00573f8f0085b81ce1de1a850"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#aff21b2a00573f8f0085b81ce1de1a850">array_list_shrink</a> (struct <a class="el" href="structarray__list.html">array_list</a> *arr, size_t empty_slots)</td></tr> 102 <tr class="separator:aff21b2a00573f8f0085b81ce1de1a850"><td class="memSeparator" colspan="2"> </td></tr> 103 </table> 104 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> 105 <div class="textblock"><p>Internal methods for working with json_type_array objects. Although this is exposed by the <a class="el" href="json__object_8h.html#a23d20e3f886c1638a7116be66b7b5ec2">json_object_get_array()</a> method, it is not recommended for direct use. </p> 106 </div><h2 class="groupheader">Macro Definition Documentation</h2> 107 <a class="anchor" id="acd30d910b398421574eb1f59e78617f5"></a> 108 <div class="memitem"> 109 <div class="memproto"> 110 <table class="memname"> 111 <tr> 112 <td class="memname">#define ARRAY_LIST_DEFAULT_SIZE   32</td> 113 </tr> 114 </table> 115 </div><div class="memdoc"> 116 117 </div> 118 </div> 119 <h2 class="groupheader">Typedef Documentation</h2> 120 <a class="anchor" id="a6d6d32d8b026ea2025df519b9e90f44a"></a> 121 <div class="memitem"> 122 <div class="memproto"> 123 <table class="memname"> 124 <tr> 125 <td class="memname">typedef struct <a class="el" href="structarray__list.html">array_list</a> <a class="el" href="structarray__list.html">array_list</a></td> 126 </tr> 127 </table> 128 </div><div class="memdoc"> 129 130 </div> 131 </div> 132 <a class="anchor" id="aad83e4ed3c8ea274e6f18459276d774b"></a> 133 <div class="memitem"> 134 <div class="memproto"> 135 <table class="memname"> 136 <tr> 137 <td class="memname">typedef void( array_list_free_fn)(void *data)</td> 138 </tr> 139 </table> 140 </div><div class="memdoc"> 141 142 </div> 143 </div> 144 <h2 class="groupheader">Function Documentation</h2> 145 <a class="anchor" id="a6e995608aa464244ff3184fb43574dc8"></a> 146 <div class="memitem"> 147 <div class="memproto"> 148 <table class="memname"> 149 <tr> 150 <td class="memname">int array_list_add </td> 151 <td>(</td> 152 <td class="paramtype">struct <a class="el" href="structarray__list.html">array_list</a> * </td> 153 <td class="paramname"><em>al</em>, </td> 154 </tr> 155 <tr> 156 <td class="paramkey"></td> 157 <td></td> 158 <td class="paramtype">void * </td> 159 <td class="paramname"><em>data</em> </td> 160 </tr> 161 <tr> 162 <td></td> 163 <td>)</td> 164 <td></td><td></td> 165 </tr> 166 </table> 167 </div><div class="memdoc"> 168 169 </div> 170 </div> 171 <a class="anchor" id="ac5d066b971fee72ce80084c1694109e3"></a> 172 <div class="memitem"> 173 <div class="memproto"> 174 <table class="memname"> 175 <tr> 176 <td class="memname">void* array_list_bsearch </td> 177 <td>(</td> 178 <td class="paramtype">const void ** </td> 179 <td class="paramname"><em>key</em>, </td> 180 </tr> 181 <tr> 182 <td class="paramkey"></td> 183 <td></td> 184 <td class="paramtype">struct <a class="el" href="structarray__list.html">array_list</a> * </td> 185 <td class="paramname"><em>arr</em>, </td> 186 </tr> 187 <tr> 188 <td class="paramkey"></td> 189 <td></td> 190 <td class="paramtype">int(*)(const void *, const void *) </td> 191 <td class="paramname"><em>compar</em> </td> 192 </tr> 193 <tr> 194 <td></td> 195 <td>)</td> 196 <td></td><td></td> 197 </tr> 198 </table> 199 </div><div class="memdoc"> 200 201 </div> 202 </div> 203 <a class="anchor" id="aecedd8601ee96e2fd8eff5d83fda89ab"></a> 204 <div class="memitem"> 205 <div class="memproto"> 206 <table class="memname"> 207 <tr> 208 <td class="memname">int array_list_del_idx </td> 209 <td>(</td> 210 <td class="paramtype">struct <a class="el" href="structarray__list.html">array_list</a> * </td> 211 <td class="paramname"><em>arr</em>, </td> 212 </tr> 213 <tr> 214 <td class="paramkey"></td> 215 <td></td> 216 <td class="paramtype">size_t </td> 217 <td class="paramname"><em>idx</em>, </td> 218 </tr> 219 <tr> 220 <td class="paramkey"></td> 221 <td></td> 222 <td class="paramtype">size_t </td> 223 <td class="paramname"><em>count</em> </td> 224 </tr> 225 <tr> 226 <td></td> 227 <td>)</td> 228 <td></td><td></td> 229 </tr> 230 </table> 231 </div><div class="memdoc"> 232 233 </div> 234 </div> 235 <a class="anchor" id="acd00fb70f7ca82f23b48b812c3498f67"></a> 236 <div class="memitem"> 237 <div class="memproto"> 238 <table class="memname"> 239 <tr> 240 <td class="memname">void array_list_free </td> 241 <td>(</td> 242 <td class="paramtype">struct <a class="el" href="structarray__list.html">array_list</a> * </td> 243 <td class="paramname"><em>al</em></td><td>)</td> 244 <td></td> 245 </tr> 246 </table> 247 </div><div class="memdoc"> 248 249 </div> 250 </div> 251 <a class="anchor" id="a114f1af5b20b76a3dbb2d1d055006df8"></a> 252 <div class="memitem"> 253 <div class="memproto"> 254 <table class="memname"> 255 <tr> 256 <td class="memname">void* array_list_get_idx </td> 257 <td>(</td> 258 <td class="paramtype">struct <a class="el" href="structarray__list.html">array_list</a> * </td> 259 <td class="paramname"><em>al</em>, </td> 260 </tr> 261 <tr> 262 <td class="paramkey"></td> 263 <td></td> 264 <td class="paramtype">size_t </td> 265 <td class="paramname"><em>i</em> </td> 266 </tr> 267 <tr> 268 <td></td> 269 <td>)</td> 270 <td></td><td></td> 271 </tr> 272 </table> 273 </div><div class="memdoc"> 274 275 </div> 276 </div> 277 <a class="anchor" id="aa3bf90f47aa210032304b14e7ad09ef7"></a> 278 <div class="memitem"> 279 <div class="memproto"> 280 <table class="memname"> 281 <tr> 282 <td class="memname">size_t array_list_length </td> 283 <td>(</td> 284 <td class="paramtype">struct <a class="el" href="structarray__list.html">array_list</a> * </td> 285 <td class="paramname"><em>al</em></td><td>)</td> 286 <td></td> 287 </tr> 288 </table> 289 </div><div class="memdoc"> 290 291 </div> 292 </div> 293 <a class="anchor" id="a0d4bfac055dfd98e17296142abf4d894"></a> 294 <div class="memitem"> 295 <div class="memproto"> 296 <table class="mlabels"> 297 <tr> 298 <td class="mlabels-left"> 299 <table class="memname"> 300 <tr> 301 <td class="memname">struct <a class="el" href="structarray__list.html">array_list</a>* array_list_new </td> 302 <td>(</td> 303 <td class="paramtype"><a class="el" href="arraylist_8h.html#aad83e4ed3c8ea274e6f18459276d774b">array_list_free_fn</a> * </td> 304 <td class="paramname"><em>free_fn</em></td><td>)</td> 305 <td></td> 306 </tr> 307 </table> 308 </td> 309 <td class="mlabels-right"> 310 <span class="mlabels"><span class="mlabel">read</span></span> </td> 311 </tr> 312 </table> 313 </div><div class="memdoc"> 314 <p>Allocate an <a class="el" href="structarray__list.html">array_list</a> of the default size (32). </p> 315 <dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000001">Deprecated:</a></b></dt><dd>Use <a class="el" href="arraylist_8h.html#ae3e43dc68f5d1815f3aaa36916602e45">array_list_new2()</a> instead. </dd></dl> 316 317 </div> 318 </div> 319 <a class="anchor" id="ae3e43dc68f5d1815f3aaa36916602e45"></a> 320 <div class="memitem"> 321 <div class="memproto"> 322 <table class="mlabels"> 323 <tr> 324 <td class="mlabels-left"> 325 <table class="memname"> 326 <tr> 327 <td class="memname">struct <a class="el" href="structarray__list.html">array_list</a>* array_list_new2 </td> 328 <td>(</td> 329 <td class="paramtype"><a class="el" href="arraylist_8h.html#aad83e4ed3c8ea274e6f18459276d774b">array_list_free_fn</a> * </td> 330 <td class="paramname"><em>free_fn</em>, </td> 331 </tr> 332 <tr> 333 <td class="paramkey"></td> 334 <td></td> 335 <td class="paramtype">int </td> 336 <td class="paramname"><em>initial_size</em> </td> 337 </tr> 338 <tr> 339 <td></td> 340 <td>)</td> 341 <td></td><td></td> 342 </tr> 343 </table> 344 </td> 345 <td class="mlabels-right"> 346 <span class="mlabels"><span class="mlabel">read</span></span> </td> 347 </tr> 348 </table> 349 </div><div class="memdoc"> 350 <p>Allocate an <a class="el" href="structarray__list.html">array_list</a> of the desired size.</p> 351 <p>If possible, the size should be chosen to closely match the actual number of elements expected to be used. If the exact size is unknown, there are tradeoffs to be made:</p> 352 <ul> 353 <li>too small - the <a class="el" href="structarray__list.html">array_list</a> code will need to call realloc() more often (which might incur an additional memory copy).</li> 354 <li>too large - will waste memory, but that can be mitigated by calling <a class="el" href="arraylist_8h.html#aff21b2a00573f8f0085b81ce1de1a850">array_list_shrink()</a> once the final size is known.</li> 355 </ul> 356 <dl class="section see"><dt>See Also</dt><dd><a class="el" href="arraylist_8h.html#aff21b2a00573f8f0085b81ce1de1a850">array_list_shrink</a> </dd></dl> 357 358 </div> 359 </div> 360 <a class="anchor" id="a9f92076e9d8229f8a07e536dc286f811"></a> 361 <div class="memitem"> 362 <div class="memproto"> 363 <table class="memname"> 364 <tr> 365 <td class="memname">int array_list_put_idx </td> 366 <td>(</td> 367 <td class="paramtype">struct <a class="el" href="structarray__list.html">array_list</a> * </td> 368 <td class="paramname"><em>al</em>, </td> 369 </tr> 370 <tr> 371 <td class="paramkey"></td> 372 <td></td> 373 <td class="paramtype">size_t </td> 374 <td class="paramname"><em>i</em>, </td> 375 </tr> 376 <tr> 377 <td class="paramkey"></td> 378 <td></td> 379 <td class="paramtype">void * </td> 380 <td class="paramname"><em>data</em> </td> 381 </tr> 382 <tr> 383 <td></td> 384 <td>)</td> 385 <td></td><td></td> 386 </tr> 387 </table> 388 </div><div class="memdoc"> 389 390 </div> 391 </div> 392 <a class="anchor" id="aff21b2a00573f8f0085b81ce1de1a850"></a> 393 <div class="memitem"> 394 <div class="memproto"> 395 <table class="memname"> 396 <tr> 397 <td class="memname">int array_list_shrink </td> 398 <td>(</td> 399 <td class="paramtype">struct <a class="el" href="structarray__list.html">array_list</a> * </td> 400 <td class="paramname"><em>arr</em>, </td> 401 </tr> 402 <tr> 403 <td class="paramkey"></td> 404 <td></td> 405 <td class="paramtype">size_t </td> 406 <td class="paramname"><em>empty_slots</em> </td> 407 </tr> 408 <tr> 409 <td></td> 410 <td>)</td> 411 <td></td><td></td> 412 </tr> 413 </table> 414 </div><div class="memdoc"> 415 <p>Shrink the array list to just enough to fit the number of elements in it, plus empty_slots. </p> 416 417 </div> 418 </div> 419 <a class="anchor" id="afb67cc8e2e5c9be41c3e644536079169"></a> 420 <div class="memitem"> 421 <div class="memproto"> 422 <table class="memname"> 423 <tr> 424 <td class="memname">void array_list_sort </td> 425 <td>(</td> 426 <td class="paramtype">struct <a class="el" href="structarray__list.html">array_list</a> * </td> 427 <td class="paramname"><em>arr</em>, </td> 428 </tr> 429 <tr> 430 <td class="paramkey"></td> 431 <td></td> 432 <td class="paramtype">int(*)(const void *, const void *) </td> 433 <td class="paramname"><em>compar</em> </td> 434 </tr> 435 <tr> 436 <td></td> 437 <td>)</td> 438 <td></td><td></td> 439 </tr> 440 </table> 441 </div><div class="memdoc"> 442 443 </div> 444 </div> 445 </div><!-- contents --> 446 <!-- start footer part --> 447 <hr class="footer"/><address class="footer"><small> 448 Generated on Sun Jul 26 2020 15:11:19 for json-c by  <a href="http://www.doxygen.org/index.html"> 449 <img class="footer" src="doxygen.png" alt="doxygen"/> 450 </a> 1.8.2 451 </small></address> 452 </body> 453 </html>
This page was automatically generated by LXR 0.3.1. • OpenWrt