📄 group__apr__ring.html
字号:
<td>
<p>
<b>Value:</b><pre class="fragment"><div><span class="keyword">struct </span>head { \
<span class="keyword">struct </span>elem *next; \
<span class="keyword">struct </span>elem *prev; \
}
</div></pre>The Ring Head<p>
Each ring is managed via its head, which is a struct declared like this: <pre>
<a class="el" href="group__apr__ring.html#ga1">APR_RING_HEAD(my_ring_t, my_element_t)</a>;
struct my_ring_t ring, *ringp;
</pre><p>
This struct looks just like the element link struct so that we can be sure that the typecasting games will work as expected.<p>
The first element in the ring is next after the head, and the last element is just before the head. </td>
</tr>
</table>
<a class="anchor" name="ga7" doxytag="apr_ring.h::APR_RING_INIT" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define APR_RING_INIT </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">hp, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>elem, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>link </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<b>Value:</b><pre class="fragment"><div><span class="keywordflow">do</span> { \
<a class="code" href="group__apr__ring.html#ga3">APR_RING_FIRST</a>((hp)) = <a class="code" href="group__apr__ring.html#ga2">APR_RING_SENTINEL</a>((hp), elem, link); \
<a class="code" href="group__apr__ring.html#ga4">APR_RING_LAST</a>((hp)) = <a class="code" href="group__apr__ring.html#ga2">APR_RING_SENTINEL</a>((hp), elem, link); \
} <span class="keywordflow">while</span> (0)
</div></pre>Initialize a ring <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>hp</em> </td><td>The head of the ring </td></tr>
<tr><td></td><td valign=top><em>elem</em> </td><td>The name of the element struct </td></tr>
<tr><td></td><td valign=top><em>link</em> </td><td>The name of the APR_RING_ENTRY in the element struct </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="ga13" doxytag="apr_ring.h::APR_RING_INSERT_AFTER" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define APR_RING_INSERT_AFTER </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">lep, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>nep, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>link </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> APR_RING_SPLICE_AFTER((lep), (nep), (nep), link)</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Insert the element nep into the ring after element lep (..lep.. becomes ..lep..nep..) <dl compact><dt><b>Warning:</b></dt><dd>This doesn't work for inserting after the last element or on empty rings... see APR_RING_INSERT_TAIL for one that does </dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>lep</em> </td><td>Element in the ring to insert after </td></tr>
<tr><td></td><td valign=top><em>nep</em> </td><td>Element to insert </td></tr>
<tr><td></td><td valign=top><em>link</em> </td><td>The name of the APR_RING_ENTRY in the element struct </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="ga12" doxytag="apr_ring.h::APR_RING_INSERT_BEFORE" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define APR_RING_INSERT_BEFORE </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">lep, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>nep, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>link </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> APR_RING_SPLICE_BEFORE((lep), (nep), (nep), link)</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Insert the element nep into the ring before element lep (..lep.. becomes ..nep..lep..) <dl compact><dt><b>Warning:</b></dt><dd>This doesn't work for inserting before the first element or on empty rings... see APR_RING_INSERT_HEAD for one that does </dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>lep</em> </td><td>Element in the ring to insert before </td></tr>
<tr><td></td><td valign=top><em>nep</em> </td><td>Element to insert </td></tr>
<tr><td></td><td valign=top><em>link</em> </td><td>The name of the APR_RING_ENTRY in the element struct </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="ga16" doxytag="apr_ring.h::APR_RING_INSERT_HEAD" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define APR_RING_INSERT_HEAD </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">hp, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>nep, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>elem, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>link </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> APR_RING_SPLICE_HEAD((hp), (nep), (nep), elem, link)</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Insert the element nep into the ring before the first element (..hp.. becomes ..hp..nep..) <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>hp</em> </td><td>Head of the ring </td></tr>
<tr><td></td><td valign=top><em>nep</em> </td><td>Element to insert </td></tr>
<tr><td></td><td valign=top><em>elem</em> </td><td>The name of the element struct </td></tr>
<tr><td></td><td valign=top><em>link</em> </td><td>The name of the APR_RING_ENTRY in the element struct </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="ga17" doxytag="apr_ring.h::APR_RING_INSERT_TAIL" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define APR_RING_INSERT_TAIL </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">hp, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>nep, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>elem, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>link </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> APR_RING_SPLICE_TAIL((hp), (nep), (nep), elem, link)</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Insert the element nep into the ring after the last element (..hp.. becomes ..nep..hp..) <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>hp</em> </td><td>Head of the ring </td></tr>
<tr><td></td><td valign=top><em>nep</em> </td><td>Element to insert </td></tr>
<tr><td></td><td valign=top><em>elem</em> </td><td>The name of the element struct </td></tr>
<tr><td></td><td valign=top><em>link</em> </td><td>The name of the APR_RING_ENTRY in the element struct </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="ga4" doxytag="apr_ring.h::APR_RING_LAST" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define APR_RING_LAST </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">hp </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> (hp)->prev</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -