⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apr__ring_8h-source.html

📁 apr函数库使用手册
💻 HTML
📖 第 1 页 / 共 3 页
字号:
00330 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span>
00331 <span class="comment"> */</span>
<a name="l00332"></a><a class="code" href="group__apr__ring.html#ga18">00332</a> <span class="preprocessor">#define APR_RING_CONCAT(h1, h2, elem, link) do {                        \</span>
00333 <span class="preprocessor">        if (!APR_RING_EMPTY((h2), elem, link)) {                        \</span>
00334 <span class="preprocessor">            APR_RING_SPLICE_BEFORE(APR_RING_SENTINEL((h1), elem, link), \</span>
00335 <span class="preprocessor">                                  APR_RING_FIRST((h2)),                 \</span>
00336 <span class="preprocessor">                                  APR_RING_LAST((h2)), link);           \</span>
00337 <span class="preprocessor">            APR_RING_INIT((h2), elem, link);                            \</span>
00338 <span class="preprocessor">        }                                                               \</span>
00339 <span class="preprocessor">    } while (0)</span>
00340 <span class="preprocessor"></span><span class="comment"></span>
00341 <span class="comment">/**</span>
00342 <span class="comment"> * Prepend ring h2 onto the beginning of ring h1, leaving h2 empty.</span>
00343 <span class="comment"> * @param h1   Head of the ring to prepend onto</span>
00344 <span class="comment"> * @param h2   Head of the ring to prepend</span>
00345 <span class="comment"> * @param elem The name of the element struct</span>
00346 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span>
00347 <span class="comment"> */</span>
<a name="l00348"></a><a class="code" href="group__apr__ring.html#ga19">00348</a> <span class="preprocessor">#define APR_RING_PREPEND(h1, h2, elem, link) do {                       \</span>
00349 <span class="preprocessor">        if (!APR_RING_EMPTY((h2), elem, link)) {                        \</span>
00350 <span class="preprocessor">            APR_RING_SPLICE_AFTER(APR_RING_SENTINEL((h1), elem, link),  \</span>
00351 <span class="preprocessor">                                  APR_RING_FIRST((h2)),                 \</span>
00352 <span class="preprocessor">                                  APR_RING_LAST((h2)), link);           \</span>
00353 <span class="preprocessor">            APR_RING_INIT((h2), elem, link);                            \</span>
00354 <span class="preprocessor">        }                                                               \</span>
00355 <span class="preprocessor">    } while (0)</span>
00356 <span class="preprocessor"></span><span class="comment"></span>
00357 <span class="comment">/**</span>
00358 <span class="comment"> * Unsplice a sequence of elements from a ring</span>
00359 <span class="comment"> * @warning The unspliced sequence is left with dangling pointers at either end</span>
00360 <span class="comment"> * @param ep1  First element in the sequence to unsplice</span>
00361 <span class="comment"> * @param epN  Last element in the sequence to unsplice</span>
00362 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span>
00363 <span class="comment"> */</span>
<a name="l00364"></a><a class="code" href="group__apr__ring.html#ga20">00364</a> <span class="preprocessor">#define APR_RING_UNSPLICE(ep1, epN, link) do {                          \</span>
00365 <span class="preprocessor">        APR_RING_NEXT(APR_RING_PREV((ep1), link), link) =               \</span>
00366 <span class="preprocessor">                     APR_RING_NEXT((epN), link);                        \</span>
00367 <span class="preprocessor">        APR_RING_PREV(APR_RING_NEXT((epN), link), link) =               \</span>
00368 <span class="preprocessor">                     APR_RING_PREV((ep1), link);                        \</span>
00369 <span class="preprocessor">    } while (0)</span>
00370 <span class="preprocessor"></span><span class="comment"></span>
00371 <span class="comment">/**</span>
00372 <span class="comment"> * Remove a single element from a ring</span>
00373 <span class="comment"> * @warning The unspliced element is left with dangling pointers at either end</span>
00374 <span class="comment"> * @param ep   Element to remove</span>
00375 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span>
00376 <span class="comment"> */</span>
<a name="l00377"></a><a class="code" href="group__apr__ring.html#ga21">00377</a> <span class="preprocessor">#define APR_RING_REMOVE(ep, link)                                       \</span>
00378 <span class="preprocessor">    APR_RING_UNSPLICE((ep), (ep), link)</span>
00379 <span class="preprocessor"></span>
00380 
00381 <span class="comment">/* Debugging tools: */</span>
00382 
00383 <span class="preprocessor">#ifdef APR_RING_DEBUG</span>
00384 <span class="preprocessor"></span><span class="preprocessor">#include &lt;stdio.h&gt;</span>
00385 <span class="preprocessor">#include &lt;assert.h&gt;</span>
00386 
00387 <span class="preprocessor">#define APR_RING_CHECK_ONE(msg, ptr)                                    \</span>
00388 <span class="preprocessor">        fprintf(stderr, "*** %s %p\n", msg, ptr)</span>
00389 <span class="preprocessor"></span>
00390 <span class="preprocessor">#define APR_RING_CHECK(hp, elem, link, msg)                             \</span>
00391 <span class="preprocessor">        APR_RING_CHECK_ELEM(APR_RING_SENTINEL(hp, elem, link), elem, link, msg)</span>
00392 <span class="preprocessor"></span>
00393 <span class="preprocessor">#define APR_RING_CHECK_ELEM(ep, elem, link, msg) do {                   \</span>
00394 <span class="preprocessor">        struct elem *start = (ep);                                      \</span>
00395 <span class="preprocessor">        struct elem *here = start;                                      \</span>
00396 <span class="preprocessor">        fprintf(stderr, "*** ring check start -- %s\n", msg);           \</span>
00397 <span class="preprocessor">        do {                                                            \</span>
00398 <span class="preprocessor">            fprintf(stderr, "\telem %p\n", here);                       \</span>
00399 <span class="preprocessor">            fprintf(stderr, "\telem-&gt;next %p\n",                        \</span>
00400 <span class="preprocessor">                    APR_RING_NEXT(here, link));                         \</span>
00401 <span class="preprocessor">            fprintf(stderr, "\telem-&gt;prev %p\n",                        \</span>
00402 <span class="preprocessor">                    APR_RING_PREV(here, link));                         \</span>
00403 <span class="preprocessor">            fprintf(stderr, "\telem-&gt;next-&gt;prev %p\n",                  \</span>
00404 <span class="preprocessor">                    APR_RING_PREV(APR_RING_NEXT(here, link), link));    \</span>
00405 <span class="preprocessor">            fprintf(stderr, "\telem-&gt;prev-&gt;next %p\n",                  \</span>
00406 <span class="preprocessor">                    APR_RING_NEXT(APR_RING_PREV(here, link), link));    \</span>
00407 <span class="preprocessor">            if (APR_RING_PREV(APR_RING_NEXT(here, link), link) != here) { \</span>
00408 <span class="preprocessor">                fprintf(stderr, "\t*** elem-&gt;next-&gt;prev != elem\n");    \</span>
00409 <span class="preprocessor">                break;                                                  \</span>
00410 <span class="preprocessor">            }                                                           \</span>
00411 <span class="preprocessor">            if (APR_RING_NEXT(APR_RING_PREV(here, link), link) != here) { \</span>
00412 <span class="preprocessor">                fprintf(stderr, "\t*** elem-&gt;prev-&gt;next != elem\n");    \</span>
00413 <span class="preprocessor">                break;                                                  \</span>
00414 <span class="preprocessor">            }                                                           \</span>
00415 <span class="preprocessor">            here = APR_RING_NEXT(here, link);                           \</span>
00416 <span class="preprocessor">        } while (here != start);                                        \</span>
00417 <span class="preprocessor">        fprintf(stderr, "*** ring check end\n");                        \</span>
00418 <span class="preprocessor">    } while (0)</span>
00419 <span class="preprocessor"></span>
00420 <span class="preprocessor">#define APR_RING_CHECK_CONSISTENCY(hp, elem, link)                      \</span>
00421 <span class="preprocessor">        APR_RING_CHECK_ELEM_CONSISTENCY(APR_RING_SENTINEL(hp, elem, link),\</span>
00422 <span class="preprocessor">                                        elem, link)</span>
00423 <span class="preprocessor"></span>
00424 <span class="preprocessor">#define APR_RING_CHECK_ELEM_CONSISTENCY(ep, elem, link) do {            \</span>
00425 <span class="preprocessor">        struct elem *start = (ep);                                      \</span>
00426 <span class="preprocessor">        struct elem *here = start;                                      \</span>
00427 <span class="preprocessor">        do {                                                            \</span>
00428 <span class="preprocessor">            assert(APR_RING_PREV(APR_RING_NEXT(here, link), link) == here); \</span>
00429 <span class="preprocessor">            assert(APR_RING_NEXT(APR_RING_PREV(here, link), link) == here); \</span>
00430 <span class="preprocessor">            here = APR_RING_NEXT(here, link);                           \</span>
00431 <span class="preprocessor">        } while (here != start);                                        \</span>
00432 <span class="preprocessor">    } while (0)</span>
00433 <span class="preprocessor"></span>
00434 <span class="preprocessor">#else</span>
00435 <span class="preprocessor"></span><span class="comment">/**</span>
00436 <span class="comment"> * Print a single pointer value to STDERR</span>
00437 <span class="comment"> *   (This is a no-op unless APR_RING_DEBUG is defined.)</span>
00438 <span class="comment"> * @param msg Descriptive message</span>
00439 <span class="comment"> * @param ptr Pointer value to print</span>
00440 <span class="comment"> */</span>
<a name="l00441"></a><a class="code" href="group__apr__ring.html#ga22">00441</a> <span class="preprocessor">#define APR_RING_CHECK_ONE(msg, ptr)</span>
00442 <span class="preprocessor"></span><span class="comment">/**</span>
00443 <span class="comment"> * Dump all ring pointers to STDERR, starting with the head and looping all</span>
00444 <span class="comment"> * the way around the ring back to the head.  Aborts if an inconsistency</span>
00445 <span class="comment"> * is found.</span>
00446 <span class="comment"> *   (This is a no-op unless APR_RING_DEBUG is defined.)</span>
00447 <span class="comment"> * @param hp   Head of the ring</span>
00448 <span class="comment"> * @param elem The name of the element struct</span>
00449 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span>
00450 <span class="comment"> * @param msg  Descriptive message</span>
00451 <span class="comment"> */</span>
<a name="l00452"></a><a class="code" href="group__apr__ring.html#ga23">00452</a> <span class="preprocessor">#define APR_RING_CHECK(hp, elem, link, msg)</span>
00453 <span class="preprocessor"></span><span class="comment">/**</span>
00454 <span class="comment"> * Loops around a ring and checks all the pointers for consistency.  Pops</span>
00455 <span class="comment"> * an assertion if any inconsistency is found.  Same idea as APR_RING_CHECK()</span>
00456 <span class="comment"> * except that it's silent if all is well.</span>
00457 <span class="comment"> *   (This is a no-op unless APR_RING_DEBUG is defined.)</span>
00458 <span class="comment"> * @param hp   Head of the ring</span>
00459 <span class="comment"> * @param elem The name of the element struct</span>
00460 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span>
00461 <span class="comment"> */</span>
<a name="l00462"></a><a class="code" href="group__apr__ring.html#ga24">00462</a> <span class="preprocessor">#define APR_RING_CHECK_CONSISTENCY(hp, elem, link)</span>
00463 <span class="preprocessor"></span><span class="comment">/**</span>
00464 <span class="comment"> * Dump all ring pointers to STDERR, starting with the given element and</span>
00465 <span class="comment"> * looping all the way around the ring back to that element.  Aborts if</span>
00466 <span class="comment"> * an inconsistency is found.</span>
00467 <span class="comment"> *   (This is a no-op unless APR_RING_DEBUG is defined.)</span>
00468 <span class="comment"> * @param ep   The element</span>
00469 <span class="comment"> * @param elem The name of the element struct</span>
00470 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span>
00471 <span class="comment"> * @param msg  Descriptive message</span>
00472 <span class="comment"> */</span>
<a name="l00473"></a><a class="code" href="group__apr__ring.html#ga25">00473</a> <span class="preprocessor">#define APR_RING_CHECK_ELEM(ep, elem, link, msg)</span>
00474 <span class="preprocessor"></span><span class="comment">/**</span>
00475 <span class="comment"> * Loops around a ring, starting with the given element, and checks all</span>
00476 <span class="comment"> * the pointers for consistency.  Pops an assertion if any inconsistency</span>
00477 <span class="comment"> * is found.  Same idea as APR_RING_CHECK_ELEM() except that it's silent</span>
00478 <span class="comment"> * if all is well.</span>
00479 <span class="comment"> *   (This is a no-op unless APR_RING_DEBUG is defined.)</span>
00480 <span class="comment"> * @param ep   The element</span>
00481 <span class="comment"> * @param elem The name of the element struct</span>
00482 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span>
00483 <span class="comment"> */</span>
<a name="l00484"></a><a class="code" href="group__apr__ring.html#ga26">00484</a> <span class="preprocessor">#define APR_RING_CHECK_ELEM_CONSISTENCY(ep, elem, link)</span>
00485 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00486 <span class="preprocessor"></span><span class="comment"></span>
00487 <span class="comment">/** @} */</span> 
00488 
00489 <span class="preprocessor">#endif </span><span class="comment">/* !APR_RING_H */</span>
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Mon Feb 7 13:18:25 2005 for Apache Portable Runtime by
<a href="../../../www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -