Modified: apr/site/trunk/docs/docs/apr/apr__ring_8h-source.html URL: http://svn.apache.org/viewcvs/apr/site/trunk/docs/docs/apr/apr__ring_8h-source.html?view=diff&r1=151767&r2=151768 ============================================================================== --- apr/site/trunk/docs/docs/apr/apr__ring_8h-source.html (original) +++ apr/site/trunk/docs/docs/apr/apr__ring_8h-source.html Mon Feb 7 15:10:17 2005 @@ -3,498 +3,499 @@ <title>Apache Portable Runtime: apr_ring.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> -<!-- Generated by Doxygen 1.3.8 --> +<!-- Generated by Doxygen 1.3.7 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> -<h1>apr_ring.h</h1><a href="apr__ring_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* Copyright 2000-2004 The Apache Software Foundation</span> -00002 <span class="comment"> *</span> -00003 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> -00004 <span class="comment"> * you may not use this file except in compliance with the License.</span> -00005 <span class="comment"> * You may obtain a copy of the License at</span> -00006 <span class="comment"> *</span> -00007 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> -00008 <span class="comment"> *</span> -00009 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> -00010 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> -00011 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> -00012 <span class="comment"> * See the License for the specific language governing permissions and</span> -00013 <span class="comment"> * limitations under the License.</span> -00014 <span class="comment"> */</span> -00015 -00016 <span class="comment">/*</span> -00017 <span class="comment"> * This code draws heavily from the 4.4BSD <sys/queue.h> macros</span> -00018 <span class="comment"> * and Dean Gaudet's "splim/ring.h".</span> -00019 <span class="comment"> * <http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/queue.h></span> -00020 <span class="comment"> * <http://www.arctic.org/~dean/splim/></span> -00021 <span class="comment"> *</span> -00022 <span class="comment"> * We'd use Dean's code directly if we could guarantee the</span> -00023 <span class="comment"> * availability of inline functions.</span> -00024 <span class="comment"> */</span> -00025 -00026 <span class="preprocessor">#ifndef APR_RING_H</span> -00027 <span class="preprocessor"></span><span class="preprocessor">#define APR_RING_H</span> -00028 <span class="preprocessor"></span><span class="comment"></span> -00029 <span class="comment">/**</span> -00030 <span class="comment"> * @file apr_ring.h</span> -00031 <span class="comment"> * @brief APR Rings</span> -00032 <span class="comment"> */</span> -00033 -00034 <span class="comment">/*</span> -00035 <span class="comment"> * for offsetof()</span> -00036 <span class="comment"> */</span> -00037 <span class="preprocessor">#include "<a class="code" href="apr__general_8h.html">apr_general.h</a>"</span> -00038 <span class="comment"></span> -00039 <span class="comment">/**</span> -00040 <span class="comment"> * @defgroup apr_ring Ring Macro Implementations</span> -00041 <span class="comment"> * @ingroup APR </span> -00042 <span class="comment"> * A ring is a kind of doubly-linked list that can be manipulated</span> -00043 <span class="comment"> * without knowing where its head is.</span> -00044 <span class="comment"> * @{</span> -00045 <span class="comment"> */</span> -00046 <span class="comment"></span> -00047 <span class="comment">/**</span> -00048 <span class="comment"> * The Ring Element</span> -00049 <span class="comment"> *</span> -00050 <span class="comment"> * A ring element struct is linked to the other elements in the ring</span> -00051 <span class="comment"> * through its ring entry field, e.g.</span> -00052 <span class="comment"> * <pre></span> -00053 <span class="comment"> * struct my_element_t {</span> -00054 <span class="comment"> * APR_RING_ENTRY(my_element_t) link;</span> -00055 <span class="comment"> * int foo;</span> -00056 <span class="comment"> * char *bar;</span> -00057 <span class="comment"> * };</span> -00058 <span class="comment"> * </pre></span> -00059 <span class="comment"> *</span> -00060 <span class="comment"> * An element struct may be put on more than one ring if it has more</span> -00061 <span class="comment"> * than one APR_RING_ENTRY field. Each APR_RING_ENTRY has a corresponding</span> -00062 <span class="comment"> * APR_RING_HEAD declaration.</span> -00063 <span class="comment"> *</span> -00064 <span class="comment"> * @warning For strict C standards compliance you should put the APR_RING_ENTRY</span> -00065 <span class="comment"> * first in the element struct unless the head is always part of a larger</span> -00066 <span class="comment"> * object with enough earlier fields to accommodate the offsetof() used</span> -00067 <span class="comment"> * to compute the ring sentinel below. You can usually ignore this caveat.</span> -00068 <span class="comment"> */</span> -<a name="l00069"></a><a class="code" href="group__apr__ring.html#ga0">00069</a> <span class="preprocessor">#define APR_RING_ENTRY(elem) \</span> -00070 <span class="preprocessor"> struct { \</span> -00071 <span class="preprocessor"> struct elem *next; \</span> -00072 <span class="preprocessor"> struct elem *prev; \</span> -00073 <span class="preprocessor"> }</span> -00074 <span class="preprocessor"></span><span class="comment"></span> -00075 <span class="comment">/**</span> -00076 <span class="comment"> * The Ring Head</span> -00077 <span class="comment"> *</span> -00078 <span class="comment"> * Each ring is managed via its head, which is a struct declared like this:</span> -00079 <span class="comment"> * <pre></span> -00080 <span class="comment"> * APR_RING_HEAD(my_ring_t, my_element_t);</span> -00081 <span class="comment"> * struct my_ring_t ring, *ringp;</span> -00082 <span class="comment"> * </pre></span> -00083 <span class="comment"> *</span> -00084 <span class="comment"> * This struct looks just like the element link struct so that we can</span> -00085 <span class="comment"> * be sure that the typecasting games will work as expected.</span> -00086 <span class="comment"> *</span> -00087 <span class="comment"> * The first element in the ring is next after the head, and the last</span> -00088 <span class="comment"> * element is just before the head.</span> -00089 <span class="comment"> */</span> -<a name="l00090"></a><a class="code" href="group__apr__ring.html#ga1">00090</a> <span class="preprocessor">#define APR_RING_HEAD(head, elem) \</span> -00091 <span class="preprocessor"> struct head { \</span> -00092 <span class="preprocessor"> struct elem *next; \</span> -00093 <span class="preprocessor"> struct elem *prev; \</span> -00094 <span class="preprocessor"> }</span> -00095 <span class="preprocessor"></span><span class="comment"></span> -00096 <span class="comment">/**</span> -00097 <span class="comment"> * The Ring Sentinel</span> -00098 <span class="comment"> *</span> -00099 <span class="comment"> * This is the magic pointer value that occurs before the first and</span> -00100 <span class="comment"> * after the last elements in the ring, computed from the address of</span> -00101 <span class="comment"> * the ring's head. The head itself isn't an element, but in order to</span> -00102 <span class="comment"> * get rid of all the special cases when dealing with the ends of the</span> -00103 <span class="comment"> * ring, we play typecasting games to make it look like one.</span> -00104 <span class="comment"> *</span> -00105 <span class="comment"> * Here is a diagram to illustrate the arrangements of the next and</span> -00106 <span class="comment"> * prev pointers of each element in a single ring. Note that they point</span> -00107 <span class="comment"> * to the start of each element, not to the APR_RING_ENTRY structure.</span> -00108 <span class="comment"> *</span> -00109 <span class="comment"> * <pre></span> -00110 <span class="comment"> * +->+------+<-+ +->+------+<-+ +->+------+<-+</span> -00111 <span class="comment"> * | |struct| | | |struct| | | |struct| |</span> -00112 <span class="comment"> * / | elem | \/ | elem | \/ | elem | \</span> -00113 <span class="comment"> * ... | | /\ | | /\ | | ...</span> -00114 <span class="comment"> * +------+ | | +------+ | | +------+</span> -00115 <span class="comment"> * ...--|prev | | +--|ring | | +--|prev |</span> -00116 <span class="comment"> * | next|--+ | entry|--+ | next|--...</span> -00117 <span class="comment"> * +------+ +------+ +------+</span> -00118 <span class="comment"> * | etc. | | etc. | | etc. |</span> -00119 <span class="comment"> * : : : : : :</span> -00120 <span class="comment"> * </pre></span> -00121 <span class="comment"> *</span> -00122 <span class="comment"> * The APR_RING_HEAD is nothing but a bare APR_RING_ENTRY. The prev</span> -00123 <span class="comment"> * and next pointers in the first and last elements don't actually</span> -00124 <span class="comment"> * point to the head, they point to a phantom place called the</span> -00125 <span class="comment"> * sentinel. Its value is such that last->next->next == first because</span> -00126 <span class="comment"> * the offset from the sentinel to the head's next pointer is the same</span> -00127 <span class="comment"> * as the offset from the start of an element to its next pointer.</span> -00128 <span class="comment"> * This also works in the opposite direction.</span> -00129 <span class="comment"> *</span> -00130 <span class="comment"> * <pre></span> -00131 <span class="comment"> * last first</span> -00132 <span class="comment"> * +->+------+<-+ +->sentinel<-+ +->+------+<-+</span> -00133 <span class="comment"> * | |struct| | | | | |struct| |</span> -00134 <span class="comment"> * / | elem | \/ \/ | elem | \</span> -00135 <span class="comment"> * ... | | /\ /\ | | ...</span> -00136 <span class="comment"> * +------+ | | +------+ | | +------+</span> -00137 <span class="comment"> * ...--|prev | | +--|ring | | +--|prev |</span> -00138 <span class="comment"> * | next|--+ | head|--+ | next|--...</span> -00139 <span class="comment"> * +------+ +------+ +------+</span> -00140 <span class="comment"> * | etc. | | etc. |</span> -00141 <span class="comment"> * : : : :</span> -00142 <span class="comment"> * </pre></span> -00143 <span class="comment"> *</span> -00144 <span class="comment"> * Note that the offset mentioned above is different for each kind of</span> -00145 <span class="comment"> * ring that the element may be on, and each kind of ring has a unique</span> -00146 <span class="comment"> * name for its APR_RING_ENTRY in each element, and has its own type</span> -00147 <span class="comment"> * for its APR_RING_HEAD.</span> -00148 <span class="comment"> *</span> -00149 <span class="comment"> * Note also that if the offset is non-zero (which is required if an</span> -00150 <span class="comment"> * element has more than one APR_RING_ENTRY), the unreality of the</span> -00151 <span class="comment"> * sentinel may have bad implications on very perverse implementations</span> -00152 <span class="comment"> * of C -- see the warning in APR_RING_ENTRY.</span> -00153 <span class="comment"> *</span> -00154 <span class="comment"> * @param hp The head of the ring</span> -00155 <span class="comment"> * @param elem The name of the element struct</span> -00156 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00157 <span class="comment"> */</span> -<a name="l00158"></a><a class="code" href="group__apr__ring.html#ga2">00158</a> <span class="preprocessor">#define APR_RING_SENTINEL(hp, elem, link) \</span> -00159 <span class="preprocessor"> (struct elem *)((char *)(hp) - APR_OFFSETOF(struct elem, link))</span> -00160 <span class="preprocessor"></span><span class="comment"></span> -00161 <span class="comment">/**</span> -00162 <span class="comment"> * The first element of the ring</span> -00163 <span class="comment"> * @param hp The head of the ring</span> -00164 <span class="comment"> */</span> -<a name="l00165"></a><a class="code" href="group__apr__ring.html#ga3">00165</a> <span class="preprocessor">#define APR_RING_FIRST(hp) (hp)->next</span> -00166 <span class="preprocessor"></span><span class="comment">/**</span> -00167 <span class="comment"> * The last element of the ring</span> -00168 <span class="comment"> * @param hp The head of the ring</span> -00169 <span class="comment"> */</span> -<a name="l00170"></a><a class="code" href="group__apr__ring.html#ga4">00170</a> <span class="preprocessor">#define APR_RING_LAST(hp) (hp)->prev</span> -00171 <span class="preprocessor"></span><span class="comment">/**</span> -00172 <span class="comment"> * The next element in the ring</span> -00173 <span class="comment"> * @param ep The current element</span> -00174 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00175 <span class="comment"> */</span> -<a name="l00176"></a><a class="code" href="group__apr__ring.html#ga5">00176</a> <span class="preprocessor">#define APR_RING_NEXT(ep, link) (ep)->link.next</span> -00177 <span class="preprocessor"></span><span class="comment">/**</span> -00178 <span class="comment"> * The previous element in the ring</span> -00179 <span class="comment"> * @param ep The current element</span> -00180 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00181 <span class="comment"> */</span> -<a name="l00182"></a><a class="code" href="group__apr__ring.html#ga6">00182</a> <span class="preprocessor">#define APR_RING_PREV(ep, link) (ep)->link.prev</span> -00183 <span class="preprocessor"></span> -00184 <span class="comment"></span> -00185 <span class="comment">/**</span> -00186 <span class="comment"> * Initialize a ring</span> -00187 <span class="comment"> * @param hp The head of the ring</span> -00188 <span class="comment"> * @param elem The name of the element struct</span> -00189 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00190 <span class="comment"> */</span> -<a name="l00191"></a><a class="code" href="group__apr__ring.html#ga7">00191</a> <span class="preprocessor">#define APR_RING_INIT(hp, elem, link) do { \</span> -00192 <span class="preprocessor"> APR_RING_FIRST((hp)) = APR_RING_SENTINEL((hp), elem, link); \</span> -00193 <span class="preprocessor"> APR_RING_LAST((hp)) = APR_RING_SENTINEL((hp), elem, link); \</span> -00194 <span class="preprocessor"> } while (0)</span> -00195 <span class="preprocessor"></span><span class="comment"></span> -00196 <span class="comment">/**</span> -00197 <span class="comment"> * Determine if a ring is empty</span> -00198 <span class="comment"> * @param hp The head of the ring</span> -00199 <span class="comment"> * @param elem The name of the element struct</span> -00200 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00201 <span class="comment"> * @return true or false</span> -00202 <span class="comment"> */</span> -<a name="l00203"></a><a class="code" href="group__apr__ring.html#ga8">00203</a> <span class="preprocessor">#define APR_RING_EMPTY(hp, elem, link) \</span> -00204 <span class="preprocessor"> (APR_RING_FIRST((hp)) == APR_RING_SENTINEL((hp), elem, link))</span> -00205 <span class="preprocessor"></span><span class="comment"></span> -00206 <span class="comment">/**</span> -00207 <span class="comment"> * Initialize a singleton element</span> -00208 <span class="comment"> * @param ep The element</span> -00209 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00210 <span class="comment"> */</span> -<a name="l00211"></a><a class="code" href="group__apr__ring.html#ga9">00211</a> <span class="preprocessor">#define APR_RING_ELEM_INIT(ep, link) do { \</span> -00212 <span class="preprocessor"> APR_RING_NEXT((ep), link) = (ep); \</span> -00213 <span class="preprocessor"> APR_RING_PREV((ep), link) = (ep); \</span> -00214 <span class="preprocessor"> } while (0)</span> -00215 <span class="preprocessor"></span> -00216 <span class="comment"></span> -00217 <span class="comment">/**</span> -00218 <span class="comment"> * Splice the sequence ep1..epN into the ring before element lep</span> -00219 <span class="comment"> * (..lep.. becomes ..ep1..epN..lep..)</span> -00220 <span class="comment"> * @warning This doesn't work for splicing before the first element or on</span> -00221 <span class="comment"> * empty rings... see APR_RING_SPLICE_HEAD for one that does</span> -00222 <span class="comment"> * @param lep Element in the ring to splice before</span> -00223 <span class="comment"> * @param ep1 First element in the sequence to splice in</span> -00224 <span class="comment"> * @param epN Last element in the sequence to splice in</span> -00225 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00226 <span class="comment"> */</span> -<a name="l00227"></a><a class="code" href="group__apr__ring.html#ga10">00227</a> <span class="preprocessor">#define APR_RING_SPLICE_BEFORE(lep, ep1, epN, link) do { \</span> -00228 <span class="preprocessor"> APR_RING_NEXT((epN), link) = (lep); \</span> -00229 <span class="preprocessor"> APR_RING_PREV((ep1), link) = APR_RING_PREV((lep), link); \</span> -00230 <span class="preprocessor"> APR_RING_NEXT(APR_RING_PREV((lep), link), link) = (ep1); \</span> -00231 <span class="preprocessor"> APR_RING_PREV((lep), link) = (epN); \</span> -00232 <span class="preprocessor"> } while (0)</span> -00233 <span class="preprocessor"></span><span class="comment"></span> -00234 <span class="comment">/**</span> -00235 <span class="comment"> * Splice the sequence ep1..epN into the ring after element lep</span> -00236 <span class="comment"> * (..lep.. becomes ..lep..ep1..epN..)</span> -00237 <span class="comment"> * @warning This doesn't work for splicing after the last element or on</span> -00238 <span class="comment"> * empty rings... see APR_RING_SPLICE_TAIL for one that does</span> -00239 <span class="comment"> * @param lep Element in the ring to splice after</span> -00240 <span class="comment"> * @param ep1 First element in the sequence to splice in</span> -00241 <span class="comment"> * @param epN Last element in the sequence to splice in</span> -00242 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00243 <span class="comment"> */</span> -<a name="l00244"></a><a class="code" href="group__apr__ring.html#ga11">00244</a> <span class="preprocessor">#define APR_RING_SPLICE_AFTER(lep, ep1, epN, link) do { \</span> -00245 <span class="preprocessor"> APR_RING_PREV((ep1), link) = (lep); \</span> -00246 <span class="preprocessor"> APR_RING_NEXT((epN), link) = APR_RING_NEXT((lep), link); \</span> -00247 <span class="preprocessor"> APR_RING_PREV(APR_RING_NEXT((lep), link), link) = (epN); \</span> -00248 <span class="preprocessor"> APR_RING_NEXT((lep), link) = (ep1); \</span> -00249 <span class="preprocessor"> } while (0)</span> -00250 <span class="preprocessor"></span><span class="comment"></span> -00251 <span class="comment">/**</span> -00252 <span class="comment"> * Insert the element nep into the ring before element lep</span> -00253 <span class="comment"> * (..lep.. becomes ..nep..lep..)</span> -00254 <span class="comment"> * @warning This doesn't work for inserting before the first element or on</span> -00255 <span class="comment"> * empty rings... see APR_RING_INSERT_HEAD for one that does</span> -00256 <span class="comment"> * @param lep Element in the ring to insert before</span> -00257 <span class="comment"> * @param nep Element to insert</span> -00258 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00259 <span class="comment"> */</span> -<a name="l00260"></a><a class="code" href="group__apr__ring.html#ga12">00260</a> <span class="preprocessor">#define APR_RING_INSERT_BEFORE(lep, nep, link) \</span> -00261 <span class="preprocessor"> APR_RING_SPLICE_BEFORE((lep), (nep), (nep), link)</span> -00262 <span class="preprocessor"></span><span class="comment"></span> -00263 <span class="comment">/**</span> -00264 <span class="comment"> * Insert the element nep into the ring after element lep</span> -00265 <span class="comment"> * (..lep.. becomes ..lep..nep..)</span> -00266 <span class="comment"> * @warning This doesn't work for inserting after the last element or on</span> -00267 <span class="comment"> * empty rings... see APR_RING_INSERT_TAIL for one that does</span> -00268 <span class="comment"> * @param lep Element in the ring to insert after</span> -00269 <span class="comment"> * @param nep Element to insert</span> -00270 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00271 <span class="comment"> */</span> -<a name="l00272"></a><a class="code" href="group__apr__ring.html#ga13">00272</a> <span class="preprocessor">#define APR_RING_INSERT_AFTER(lep, nep, link) \</span> -00273 <span class="preprocessor"> APR_RING_SPLICE_AFTER((lep), (nep), (nep), link)</span> -00274 <span class="preprocessor"></span> -00275 <span class="comment"></span> -00276 <span class="comment">/**</span> -00277 <span class="comment"> * Splice the sequence ep1..epN into the ring before the first element</span> -00278 <span class="comment"> * (..hp.. becomes ..hp..ep1..epN..)</span> -00279 <span class="comment"> * @param hp Head of the ring</span> -00280 <span class="comment"> * @param ep1 First element in the sequence to splice in</span> -00281 <span class="comment"> * @param epN Last element in the sequence to splice in</span> -00282 <span class="comment"> * @param elem The name of the element struct</span> -00283 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00284 <span class="comment"> */</span> -<a name="l00285"></a><a class="code" href="group__apr__ring.html#ga14">00285</a> <span class="preprocessor">#define APR_RING_SPLICE_HEAD(hp, ep1, epN, elem, link) \</span> -00286 <span class="preprocessor"> APR_RING_SPLICE_AFTER(APR_RING_SENTINEL((hp), elem, link), \</span> -00287 <span class="preprocessor"> (ep1), (epN), link)</span> -00288 <span class="preprocessor"></span><span class="comment"></span> -00289 <span class="comment">/**</span> -00290 <span class="comment"> * Splice the sequence ep1..epN into the ring after the last element</span> -00291 <span class="comment"> * (..hp.. becomes ..ep1..epN..hp..)</span> -00292 <span class="comment"> * @param hp Head of the ring</span> -00293 <span class="comment"> * @param ep1 First element in the sequence to splice in</span> -00294 <span class="comment"> * @param epN Last element in the sequence to splice in</span> -00295 <span class="comment"> * @param elem The name of the element struct</span> -00296 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00297 <span class="comment"> */</span> -<a name="l00298"></a><a class="code" href="group__apr__ring.html#ga15">00298</a> <span class="preprocessor">#define APR_RING_SPLICE_TAIL(hp, ep1, epN, elem, link) \</span> -00299 <span class="preprocessor"> APR_RING_SPLICE_BEFORE(APR_RING_SENTINEL((hp), elem, link), \</span> -00300 <span class="preprocessor"> (ep1), (epN), link)</span> -00301 <span class="preprocessor"></span><span class="comment"></span> -00302 <span class="comment">/**</span> -00303 <span class="comment"> * Insert the element nep into the ring before the first element</span> -00304 <span class="comment"> * (..hp.. becomes ..hp..nep..)</span> -00305 <span class="comment"> * @param hp Head of the ring</span> -00306 <span class="comment"> * @param nep Element to insert</span> -00307 <span class="comment"> * @param elem The name of the element struct</span> -00308 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00309 <span class="comment"> */</span> -<a name="l00310"></a><a class="code" href="group__apr__ring.html#ga16">00310</a> <span class="preprocessor">#define APR_RING_INSERT_HEAD(hp, nep, elem, link) \</span> -00311 <span class="preprocessor"> APR_RING_SPLICE_HEAD((hp), (nep), (nep), elem, link)</span> -00312 <span class="preprocessor"></span><span class="comment"></span> -00313 <span class="comment">/**</span> -00314 <span class="comment"> * Insert the element nep into the ring after the last element</span> -00315 <span class="comment"> * (..hp.. becomes ..nep..hp..)</span> -00316 <span class="comment"> * @param hp Head of the ring</span> -00317 <span class="comment"> * @param nep Element to insert</span> -00318 <span class="comment"> * @param elem The name of the element struct</span> -00319 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00320 <span class="comment"> */</span> -<a name="l00321"></a><a class="code" href="group__apr__ring.html#ga17">00321</a> <span class="preprocessor">#define APR_RING_INSERT_TAIL(hp, nep, elem, link) \</span> -00322 <span class="preprocessor"> APR_RING_SPLICE_TAIL((hp), (nep), (nep), elem, link)</span> -00323 <span class="preprocessor"></span><span class="comment"></span> -00324 <span class="comment">/**</span> -00325 <span class="comment"> * Concatenate ring h2 onto the end of ring h1, leaving h2 empty.</span> -00326 <span class="comment"> * @param h1 Head of the ring to concatenate onto</span> -00327 <span class="comment"> * @param h2 Head of the ring to concatenate</span> -00328 <span class="comment"> * @param elem The name of the element struct</span> -00329 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00330 <span class="comment"> */</span> -<a name="l00331"></a><a class="code" href="group__apr__ring.html#ga18">00331</a> <span class="preprocessor">#define APR_RING_CONCAT(h1, h2, elem, link) do { \</span> -00332 <span class="preprocessor"> if (!APR_RING_EMPTY((h2), elem, link)) { \</span> -00333 <span class="preprocessor"> APR_RING_SPLICE_BEFORE(APR_RING_SENTINEL((h1), elem, link), \</span> -00334 <span class="preprocessor"> APR_RING_FIRST((h2)), \</span> -00335 <span class="preprocessor"> APR_RING_LAST((h2)), link); \</span> -00336 <span class="preprocessor"> APR_RING_INIT((h2), elem, link); \</span> -00337 <span class="preprocessor"> } \</span> -00338 <span class="preprocessor"> } while (0)</span> -00339 <span class="preprocessor"></span><span class="comment"></span> -00340 <span class="comment">/**</span> -00341 <span class="comment"> * Prepend ring h2 onto the beginning of ring h1, leaving h2 empty.</span> -00342 <span class="comment"> * @param h1 Head of the ring to prepend onto</span> -00343 <span class="comment"> * @param h2 Head of the ring to prepend</span> -00344 <span class="comment"> * @param elem The name of the element struct</span> -00345 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00346 <span class="comment"> */</span> -<a name="l00347"></a><a class="code" href="group__apr__ring.html#ga19">00347</a> <span class="preprocessor">#define APR_RING_PREPEND(h1, h2, elem, link) do { \</span> -00348 <span class="preprocessor"> if (!APR_RING_EMPTY((h2), elem, link)) { \</span> -00349 <span class="preprocessor"> APR_RING_SPLICE_AFTER(APR_RING_SENTINEL((h1), elem, link), \</span> -00350 <span class="preprocessor"> APR_RING_FIRST((h2)), \</span> -00351 <span class="preprocessor"> APR_RING_LAST((h2)), link); \</span> -00352 <span class="preprocessor"> APR_RING_INIT((h2), elem, link); \</span> -00353 <span class="preprocessor"> } \</span> -00354 <span class="preprocessor"> } while (0)</span> -00355 <span class="preprocessor"></span><span class="comment"></span> -00356 <span class="comment">/**</span> -00357 <span class="comment"> * Unsplice a sequence of elements from a ring</span> -00358 <span class="comment"> * @warning The unspliced sequence is left with dangling pointers at either end</span> -00359 <span class="comment"> * @param ep1 First element in the sequence to unsplice</span> -00360 <span class="comment"> * @param epN Last element in the sequence to unsplice</span> -00361 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00362 <span class="comment"> */</span> -<a name="l00363"></a><a class="code" href="group__apr__ring.html#ga20">00363</a> <span class="preprocessor">#define APR_RING_UNSPLICE(ep1, epN, link) do { \</span> -00364 <span class="preprocessor"> APR_RING_NEXT(APR_RING_PREV((ep1), link), link) = \</span> -00365 <span class="preprocessor"> APR_RING_NEXT((epN), link); \</span> -00366 <span class="preprocessor"> APR_RING_PREV(APR_RING_NEXT((epN), link), link) = \</span> -00367 <span class="preprocessor"> APR_RING_PREV((ep1), link); \</span> -00368 <span class="preprocessor"> } while (0)</span> -00369 <span class="preprocessor"></span><span class="comment"></span> -00370 <span class="comment">/**</span> -00371 <span class="comment"> * Remove a single element from a ring</span> -00372 <span class="comment"> * @warning The unspliced element is left with dangling pointers at either end</span> -00373 <span class="comment"> * @param ep Element to remove</span> -00374 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00375 <span class="comment"> */</span> -<a name="l00376"></a><a class="code" href="group__apr__ring.html#ga21">00376</a> <span class="preprocessor">#define APR_RING_REMOVE(ep, link) \</span> -00377 <span class="preprocessor"> APR_RING_UNSPLICE((ep), (ep), link)</span> -00378 <span class="preprocessor"></span> -00379 -00380 <span class="comment">/* Debugging tools: */</span> -00381 -00382 <span class="preprocessor">#ifdef APR_RING_DEBUG</span> -00383 <span class="preprocessor"></span><span class="preprocessor">#include <stdio.h></span> -00384 <span class="preprocessor">#include <assert.h></span> -00385 -00386 <span class="preprocessor">#define APR_RING_CHECK_ONE(msg, ptr) \</span> -00387 <span class="preprocessor"> fprintf(stderr, "*** %s %p\n", msg, ptr)</span> -00388 <span class="preprocessor"></span> -00389 <span class="preprocessor">#define APR_RING_CHECK(hp, elem, link, msg) \</span> -00390 <span class="preprocessor"> APR_RING_CHECK_ELEM(APR_RING_SENTINEL(hp, elem, link), elem, link, msg)</span> -00391 <span class="preprocessor"></span> -00392 <span class="preprocessor">#define APR_RING_CHECK_ELEM(ep, elem, link, msg) do { \</span> -00393 <span class="preprocessor"> struct elem *start = (ep); \</span> -00394 <span class="preprocessor"> struct elem *here = start; \</span> -00395 <span class="preprocessor"> fprintf(stderr, "*** ring check start -- %s\n", msg); \</span> -00396 <span class="preprocessor"> do { \</span> -00397 <span class="preprocessor"> fprintf(stderr, "\telem %p\n", here); \</span> -00398 <span class="preprocessor"> fprintf(stderr, "\telem->next %p\n", \</span> -00399 <span class="preprocessor"> APR_RING_NEXT(here, link)); \</span> -00400 <span class="preprocessor"> fprintf(stderr, "\telem->prev %p\n", \</span> -00401 <span class="preprocessor"> APR_RING_PREV(here, link)); \</span> -00402 <span class="preprocessor"> fprintf(stderr, "\telem->next->prev %p\n", \</span> -00403 <span class="preprocessor"> APR_RING_PREV(APR_RING_NEXT(here, link), link)); \</span> -00404 <span class="preprocessor"> fprintf(stderr, "\telem->prev->next %p\n", \</span> -00405 <span class="preprocessor"> APR_RING_NEXT(APR_RING_PREV(here, link), link)); \</span> -00406 <span class="preprocessor"> if (APR_RING_PREV(APR_RING_NEXT(here, link), link) != here) { \</span> -00407 <span class="preprocessor"> fprintf(stderr, "\t*** elem->next->prev != elem\n"); \</span> -00408 <span class="preprocessor"> break; \</span> -00409 <span class="preprocessor"> } \</span> -00410 <span class="preprocessor"> if (APR_RING_NEXT(APR_RING_PREV(here, link), link) != here) { \</span> -00411 <span class="preprocessor"> fprintf(stderr, "\t*** elem->prev->next != elem\n"); \</span> -00412 <span class="preprocessor"> break; \</span> -00413 <span class="preprocessor"> } \</span> -00414 <span class="preprocessor"> here = APR_RING_NEXT(here, link); \</span> -00415 <span class="preprocessor"> } while (here != start); \</span> -00416 <span class="preprocessor"> fprintf(stderr, "*** ring check end\n"); \</span> -00417 <span class="preprocessor"> } while (0)</span> -00418 <span class="preprocessor"></span> -00419 <span class="preprocessor">#define APR_RING_CHECK_CONSISTENCY(hp, elem, link) \</span> -00420 <span class="preprocessor"> APR_RING_CHECK_ELEM_CONSISTENCY(APR_RING_SENTINEL(hp, elem, link),\</span> -00421 <span class="preprocessor"> elem, link)</span> -00422 <span class="preprocessor"></span> -00423 <span class="preprocessor">#define APR_RING_CHECK_ELEM_CONSISTENCY(ep, elem, link) do { \</span> -00424 <span class="preprocessor"> struct elem *start = (ep); \</span> -00425 <span class="preprocessor"> struct elem *here = start; \</span> -00426 <span class="preprocessor"> do { \</span> -00427 <span class="preprocessor"> assert(APR_RING_PREV(APR_RING_NEXT(here, link), link) == here); \</span> -00428 <span class="preprocessor"> assert(APR_RING_NEXT(APR_RING_PREV(here, link), link) == here); \</span> -00429 <span class="preprocessor"> here = APR_RING_NEXT(here, link); \</span> -00430 <span class="preprocessor"> } while (here != start); \</span> -00431 <span class="preprocessor"> } while (0)</span> -00432 <span class="preprocessor"></span> -00433 <span class="preprocessor">#else</span> -00434 <span class="preprocessor"></span><span class="comment">/**</span> -00435 <span class="comment"> * Print a single pointer value to STDERR</span> -00436 <span class="comment"> * (This is a no-op unless APR_RING_DEBUG is defined.)</span> -00437 <span class="comment"> * @param msg Descriptive message</span> -00438 <span class="comment"> * @param ptr Pointer value to print</span> -00439 <span class="comment"> */</span> -<a name="l00440"></a><a class="code" href="group__apr__ring.html#ga22">00440</a> <span class="preprocessor">#define APR_RING_CHECK_ONE(msg, ptr)</span> -00441 <span class="preprocessor"></span><span class="comment">/**</span> -00442 <span class="comment"> * Dump all ring pointers to STDERR, starting with the head and looping all</span> -00443 <span class="comment"> * the way around the ring back to the head. Aborts if an inconsistency</span> -00444 <span class="comment"> * is found.</span> -00445 <span class="comment"> * (This is a no-op unless APR_RING_DEBUG is defined.)</span> -00446 <span class="comment"> * @param hp Head of the ring</span> -00447 <span class="comment"> * @param elem The name of the element struct</span> -00448 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00449 <span class="comment"> * @param msg Descriptive message</span> -00450 <span class="comment"> */</span> -<a name="l00451"></a><a class="code" href="group__apr__ring.html#ga23">00451</a> <span class="preprocessor">#define APR_RING_CHECK(hp, elem, link, msg)</span> -00452 <span class="preprocessor"></span><span class="comment">/**</span> -00453 <span class="comment"> * Loops around a ring and checks all the pointers for consistency. Pops</span> -00454 <span class="comment"> * an assertion if any inconsistency is found. Same idea as APR_RING_CHECK()</span> -00455 <span class="comment"> * except that it's silent if all is well.</span> -00456 <span class="comment"> * (This is a no-op unless APR_RING_DEBUG is defined.)</span> -00457 <span class="comment"> * @param hp Head of the ring</span> -00458 <span class="comment"> * @param elem The name of the element struct</span> -00459 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00460 <span class="comment"> */</span> -<a name="l00461"></a><a class="code" href="group__apr__ring.html#ga24">00461</a> <span class="preprocessor">#define APR_RING_CHECK_CONSISTENCY(hp, elem, link)</span> -00462 <span class="preprocessor"></span><span class="comment">/**</span> -00463 <span class="comment"> * Dump all ring pointers to STDERR, starting with the given element and</span> -00464 <span class="comment"> * looping all the way around the ring back to that element. Aborts if</span> -00465 <span class="comment"> * an inconsistency is found.</span> -00466 <span class="comment"> * (This is a no-op unless APR_RING_DEBUG is defined.)</span> -00467 <span class="comment"> * @param ep The element</span> -00468 <span class="comment"> * @param elem The name of the element struct</span> -00469 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00470 <span class="comment"> * @param msg Descriptive message</span> -00471 <span class="comment"> */</span> -<a name="l00472"></a><a class="code" href="group__apr__ring.html#ga25">00472</a> <span class="preprocessor">#define APR_RING_CHECK_ELEM(ep, elem, link, msg)</span> -00473 <span class="preprocessor"></span><span class="comment">/**</span> -00474 <span class="comment"> * Loops around a ring, starting with the given element, and checks all</span> -00475 <span class="comment"> * the pointers for consistency. Pops an assertion if any inconsistency</span> -00476 <span class="comment"> * is found. Same idea as APR_RING_CHECK_ELEM() except that it's silent</span> -00477 <span class="comment"> * if all is well.</span> -00478 <span class="comment"> * (This is a no-op unless APR_RING_DEBUG is defined.)</span> -00479 <span class="comment"> * @param ep The element</span> -00480 <span class="comment"> * @param elem The name of the element struct</span> -00481 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> -00482 <span class="comment"> */</span> -<a name="l00483"></a><a class="code" href="group__apr__ring.html#ga26">00483</a> <span class="preprocessor">#define APR_RING_CHECK_ELEM_CONSISTENCY(ep, elem, link)</span> -00484 <span class="preprocessor"></span><span class="preprocessor">#endif</span> -00485 <span class="preprocessor"></span><span class="comment"></span> -00486 <span class="comment">/** @} */</span> -00487 -00488 <span class="preprocessor">#endif </span><span class="comment">/* !APR_RING_H */</span> -</div></pre><hr size="1"><address style="align: right;"><small>Generated on Wed Sep 1 21:36:05 2004 for Apache Portable Runtime by +<h1>apr_ring.h</h1><a href="apr__ring_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as</span> +00002 <span class="comment"> * applicable.</span> +00003 <span class="comment"> *</span> +00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> +00005 <span class="comment"> * you may not use this file except in compliance with the License.</span> +00006 <span class="comment"> * You may obtain a copy of the License at</span> +00007 <span class="comment"> *</span> +00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> +00009 <span class="comment"> *</span> +00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> +00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> +00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> +00013 <span class="comment"> * See the License for the specific language governing permissions and</span> +00014 <span class="comment"> * limitations under the License.</span> +00015 <span class="comment"> */</span> +00016 +00017 <span class="comment">/*</span> +00018 <span class="comment"> * This code draws heavily from the 4.4BSD <sys/queue.h> macros</span> +00019 <span class="comment"> * and Dean Gaudet's "splim/ring.h".</span> +00020 <span class="comment"> * <http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/queue.h></span> +00021 <span class="comment"> * <http://www.arctic.org/~dean/splim/></span> +00022 <span class="comment"> *</span> +00023 <span class="comment"> * We'd use Dean's code directly if we could guarantee the</span> +00024 <span class="comment"> * availability of inline functions.</span> +00025 <span class="comment"> */</span> +00026 +00027 <span class="preprocessor">#ifndef APR_RING_H</span> +00028 <span class="preprocessor"></span><span class="preprocessor">#define APR_RING_H</span> +00029 <span class="preprocessor"></span><span class="comment"></span> +00030 <span class="comment">/**</span> +00031 <span class="comment"> * @file apr_ring.h</span> +00032 <span class="comment"> * @brief APR Rings</span> +00033 <span class="comment"> */</span> +00034 +00035 <span class="comment">/*</span> +00036 <span class="comment"> * for offsetof()</span> +00037 <span class="comment"> */</span> +00038 <span class="preprocessor">#include "<a class="code" href="apr__general_8h.html">apr_general.h</a>"</span> +00039 <span class="comment"></span> +00040 <span class="comment">/**</span> +00041 <span class="comment"> * @defgroup apr_ring Ring Macro Implementations</span> +00042 <span class="comment"> * @ingroup APR </span> +00043 <span class="comment"> * A ring is a kind of doubly-linked list that can be manipulated</span> +00044 <span class="comment"> * without knowing where its head is.</span> +00045 <span class="comment"> * @{</span> +00046 <span class="comment"> */</span> +00047 <span class="comment"></span> +00048 <span class="comment">/**</span> +00049 <span class="comment"> * The Ring Element</span> +00050 <span class="comment"> *</span> +00051 <span class="comment"> * A ring element struct is linked to the other elements in the ring</span> +00052 <span class="comment"> * through its ring entry field, e.g.</span> +00053 <span class="comment"> * <pre></span> +00054 <span class="comment"> * struct my_element_t {</span> +00055 <span class="comment"> * APR_RING_ENTRY(my_element_t) link;</span> +00056 <span class="comment"> * int foo;</span> +00057 <span class="comment"> * char *bar;</span> +00058 <span class="comment"> * };</span> +00059 <span class="comment"> * </pre></span> +00060 <span class="comment"> *</span> +00061 <span class="comment"> * An element struct may be put on more than one ring if it has more</span> +00062 <span class="comment"> * than one APR_RING_ENTRY field. Each APR_RING_ENTRY has a corresponding</span> +00063 <span class="comment"> * APR_RING_HEAD declaration.</span> +00064 <span class="comment"> *</span> +00065 <span class="comment"> * @warning For strict C standards compliance you should put the APR_RING_ENTRY</span> +00066 <span class="comment"> * first in the element struct unless the head is always part of a larger</span> +00067 <span class="comment"> * object with enough earlier fields to accommodate the offsetof() used</span> +00068 <span class="comment"> * to compute the ring sentinel below. You can usually ignore this caveat.</span> +00069 <span class="comment"> */</span> +<a name="l00070"></a><a class="code" href="group__apr__ring.html#ga0">00070</a> <span class="preprocessor">#define APR_RING_ENTRY(elem) \</span> +00071 <span class="preprocessor"> struct { \</span> +00072 <span class="preprocessor"> struct elem *next; \</span> +00073 <span class="preprocessor"> struct elem *prev; \</span> +00074 <span class="preprocessor"> }</span> +00075 <span class="preprocessor"></span><span class="comment"></span> +00076 <span class="comment">/**</span> +00077 <span class="comment"> * The Ring Head</span> +00078 <span class="comment"> *</span> +00079 <span class="comment"> * Each ring is managed via its head, which is a struct declared like this:</span> +00080 <span class="comment"> * <pre></span> +00081 <span class="comment"> * APR_RING_HEAD(my_ring_t, my_element_t);</span> +00082 <span class="comment"> * struct my_ring_t ring, *ringp;</span> +00083 <span class="comment"> * </pre></span> +00084 <span class="comment"> *</span> +00085 <span class="comment"> * This struct looks just like the element link struct so that we can</span> +00086 <span class="comment"> * be sure that the typecasting games will work as expected.</span> +00087 <span class="comment"> *</span> +00088 <span class="comment"> * The first element in the ring is next after the head, and the last</span> +00089 <span class="comment"> * element is just before the head.</span> +00090 <span class="comment"> */</span> +<a name="l00091"></a><a class="code" href="group__apr__ring.html#ga1">00091</a> <span class="preprocessor">#define APR_RING_HEAD(head, elem) \</span> +00092 <span class="preprocessor"> struct head { \</span> +00093 <span class="preprocessor"> struct elem *next; \</span> +00094 <span class="preprocessor"> struct elem *prev; \</span> +00095 <span class="preprocessor"> }</span> +00096 <span class="preprocessor"></span><span class="comment"></span> +00097 <span class="comment">/**</span> +00098 <span class="comment"> * The Ring Sentinel</span> +00099 <span class="comment"> *</span> +00100 <span class="comment"> * This is the magic pointer value that occurs before the first and</span> +00101 <span class="comment"> * after the last elements in the ring, computed from the address of</span> +00102 <span class="comment"> * the ring's head. The head itself isn't an element, but in order to</span> +00103 <span class="comment"> * get rid of all the special cases when dealing with the ends of the</span> +00104 <span class="comment"> * ring, we play typecasting games to make it look like one.</span> +00105 <span class="comment"> *</span> +00106 <span class="comment"> * Here is a diagram to illustrate the arrangements of the next and</span> +00107 <span class="comment"> * prev pointers of each element in a single ring. Note that they point</span> +00108 <span class="comment"> * to the start of each element, not to the APR_RING_ENTRY structure.</span> +00109 <span class="comment"> *</span> +00110 <span class="comment"> * <pre></span> +00111 <span class="comment"> * +->+------+<-+ +->+------+<-+ +->+------+<-+</span> +00112 <span class="comment"> * | |struct| | | |struct| | | |struct| |</span> +00113 <span class="comment"> * / | elem | \/ | elem | \/ | elem | \</span> +00114 <span class="comment"> * ... | | /\ | | /\ | | ...</span> +00115 <span class="comment"> * +------+ | | +------+ | | +------+</span> +00116 <span class="comment"> * ...--|prev | | +--|ring | | +--|prev |</span> +00117 <span class="comment"> * | next|--+ | entry|--+ | next|--...</span> +00118 <span class="comment"> * +------+ +------+ +------+</span> +00119 <span class="comment"> * | etc. | | etc. | | etc. |</span> +00120 <span class="comment"> * : : : : : :</span> +00121 <span class="comment"> * </pre></span> +00122 <span class="comment"> *</span> +00123 <span class="comment"> * The APR_RING_HEAD is nothing but a bare APR_RING_ENTRY. The prev</span> +00124 <span class="comment"> * and next pointers in the first and last elements don't actually</span> +00125 <span class="comment"> * point to the head, they point to a phantom place called the</span> +00126 <span class="comment"> * sentinel. Its value is such that last->next->next == first because</span> +00127 <span class="comment"> * the offset from the sentinel to the head's next pointer is the same</span> +00128 <span class="comment"> * as the offset from the start of an element to its next pointer.</span> +00129 <span class="comment"> * This also works in the opposite direction.</span> +00130 <span class="comment"> *</span> +00131 <span class="comment"> * <pre></span> +00132 <span class="comment"> * last first</span> +00133 <span class="comment"> * +->+------+<-+ +->sentinel<-+ +->+------+<-+</span> +00134 <span class="comment"> * | |struct| | | | | |struct| |</span> +00135 <span class="comment"> * / | elem | \/ \/ | elem | \</span> +00136 <span class="comment"> * ... | | /\ /\ | | ...</span> +00137 <span class="comment"> * +------+ | | +------+ | | +------+</span> +00138 <span class="comment"> * ...--|prev | | +--|ring | | +--|prev |</span> +00139 <span class="comment"> * | next|--+ | head|--+ | next|--...</span> +00140 <span class="comment"> * +------+ +------+ +------+</span> +00141 <span class="comment"> * | etc. | | etc. |</span> +00142 <span class="comment"> * : : : :</span> +00143 <span class="comment"> * </pre></span> +00144 <span class="comment"> *</span> +00145 <span class="comment"> * Note that the offset mentioned above is different for each kind of</span> +00146 <span class="comment"> * ring that the element may be on, and each kind of ring has a unique</span> +00147 <span class="comment"> * name for its APR_RING_ENTRY in each element, and has its own type</span> +00148 <span class="comment"> * for its APR_RING_HEAD.</span> +00149 <span class="comment"> *</span> +00150 <span class="comment"> * Note also that if the offset is non-zero (which is required if an</span> +00151 <span class="comment"> * element has more than one APR_RING_ENTRY), the unreality of the</span> +00152 <span class="comment"> * sentinel may have bad implications on very perverse implementations</span> +00153 <span class="comment"> * of C -- see the warning in APR_RING_ENTRY.</span> +00154 <span class="comment"> *</span> +00155 <span class="comment"> * @param hp The head of the ring</span> +00156 <span class="comment"> * @param elem The name of the element struct</span> +00157 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00158 <span class="comment"> */</span> +<a name="l00159"></a><a class="code" href="group__apr__ring.html#ga2">00159</a> <span class="preprocessor">#define APR_RING_SENTINEL(hp, elem, link) \</span> +00160 <span class="preprocessor"> (struct elem *)((char *)(hp) - APR_OFFSETOF(struct elem, link))</span> +00161 <span class="preprocessor"></span><span class="comment"></span> +00162 <span class="comment">/**</span> +00163 <span class="comment"> * The first element of the ring</span> +00164 <span class="comment"> * @param hp The head of the ring</span> +00165 <span class="comment"> */</span> +<a name="l00166"></a><a class="code" href="group__apr__ring.html#ga3">00166</a> <span class="preprocessor">#define APR_RING_FIRST(hp) (hp)->next</span> +00167 <span class="preprocessor"></span><span class="comment">/**</span> +00168 <span class="comment"> * The last element of the ring</span> +00169 <span class="comment"> * @param hp The head of the ring</span> +00170 <span class="comment"> */</span> +<a name="l00171"></a><a class="code" href="group__apr__ring.html#ga4">00171</a> <span class="preprocessor">#define APR_RING_LAST(hp) (hp)->prev</span> +00172 <span class="preprocessor"></span><span class="comment">/**</span> +00173 <span class="comment"> * The next element in the ring</span> +00174 <span class="comment"> * @param ep The current element</span> +00175 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00176 <span class="comment"> */</span> +<a name="l00177"></a><a class="code" href="group__apr__ring.html#ga5">00177</a> <span class="preprocessor">#define APR_RING_NEXT(ep, link) (ep)->link.next</span> +00178 <span class="preprocessor"></span><span class="comment">/**</span> +00179 <span class="comment"> * The previous element in the ring</span> +00180 <span class="comment"> * @param ep The current element</span> +00181 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00182 <span class="comment"> */</span> +<a name="l00183"></a><a class="code" href="group__apr__ring.html#ga6">00183</a> <span class="preprocessor">#define APR_RING_PREV(ep, link) (ep)->link.prev</span> +00184 <span class="preprocessor"></span> +00185 <span class="comment"></span> +00186 <span class="comment">/**</span> +00187 <span class="comment"> * Initialize a ring</span> +00188 <span class="comment"> * @param hp The head of the ring</span> +00189 <span class="comment"> * @param elem The name of the element struct</span> +00190 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00191 <span class="comment"> */</span> +<a name="l00192"></a><a class="code" href="group__apr__ring.html#ga7">00192</a> <span class="preprocessor">#define APR_RING_INIT(hp, elem, link) do { \</span> +00193 <span class="preprocessor"> APR_RING_FIRST((hp)) = APR_RING_SENTINEL((hp), elem, link); \</span> +00194 <span class="preprocessor"> APR_RING_LAST((hp)) = APR_RING_SENTINEL((hp), elem, link); \</span> +00195 <span class="preprocessor"> } while (0)</span> +00196 <span class="preprocessor"></span><span class="comment"></span> +00197 <span class="comment">/**</span> +00198 <span class="comment"> * Determine if a ring is empty</span> +00199 <span class="comment"> * @param hp The head of the ring</span> +00200 <span class="comment"> * @param elem The name of the element struct</span> +00201 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00202 <span class="comment"> * @return true or false</span> +00203 <span class="comment"> */</span> +<a name="l00204"></a><a class="code" href="group__apr__ring.html#ga8">00204</a> <span class="preprocessor">#define APR_RING_EMPTY(hp, elem, link) \</span> +00205 <span class="preprocessor"> (APR_RING_FIRST((hp)) == APR_RING_SENTINEL((hp), elem, link))</span> +00206 <span class="preprocessor"></span><span class="comment"></span> +00207 <span class="comment">/**</span> +00208 <span class="comment"> * Initialize a singleton element</span> +00209 <span class="comment"> * @param ep The element</span> +00210 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00211 <span class="comment"> */</span> +<a name="l00212"></a><a class="code" href="group__apr__ring.html#ga9">00212</a> <span class="preprocessor">#define APR_RING_ELEM_INIT(ep, link) do { \</span> +00213 <span class="preprocessor"> APR_RING_NEXT((ep), link) = (ep); \</span> +00214 <span class="preprocessor"> APR_RING_PREV((ep), link) = (ep); \</span> +00215 <span class="preprocessor"> } while (0)</span> +00216 <span class="preprocessor"></span> +00217 <span class="comment"></span> +00218 <span class="comment">/**</span> +00219 <span class="comment"> * Splice the sequence ep1..epN into the ring before element lep</span> +00220 <span class="comment"> * (..lep.. becomes ..ep1..epN..lep..)</span> +00221 <span class="comment"> * @warning This doesn't work for splicing before the first element or on</span> +00222 <span class="comment"> * empty rings... see APR_RING_SPLICE_HEAD for one that does</span> +00223 <span class="comment"> * @param lep Element in the ring to splice before</span> +00224 <span class="comment"> * @param ep1 First element in the sequence to splice in</span> +00225 <span class="comment"> * @param epN Last element in the sequence to splice in</span> +00226 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00227 <span class="comment"> */</span> +<a name="l00228"></a><a class="code" href="group__apr__ring.html#ga10">00228</a> <span class="preprocessor">#define APR_RING_SPLICE_BEFORE(lep, ep1, epN, link) do { \</span> +00229 <span class="preprocessor"> APR_RING_NEXT((epN), link) = (lep); \</span> +00230 <span class="preprocessor"> APR_RING_PREV((ep1), link) = APR_RING_PREV((lep), link); \</span> +00231 <span class="preprocessor"> APR_RING_NEXT(APR_RING_PREV((lep), link), link) = (ep1); \</span> +00232 <span class="preprocessor"> APR_RING_PREV((lep), link) = (epN); \</span> +00233 <span class="preprocessor"> } while (0)</span> +00234 <span class="preprocessor"></span><span class="comment"></span> +00235 <span class="comment">/**</span> +00236 <span class="comment"> * Splice the sequence ep1..epN into the ring after element lep</span> +00237 <span class="comment"> * (..lep.. becomes ..lep..ep1..epN..)</span> +00238 <span class="comment"> * @warning This doesn't work for splicing after the last element or on</span> +00239 <span class="comment"> * empty rings... see APR_RING_SPLICE_TAIL for one that does</span> +00240 <span class="comment"> * @param lep Element in the ring to splice after</span> +00241 <span class="comment"> * @param ep1 First element in the sequence to splice in</span> +00242 <span class="comment"> * @param epN Last element in the sequence to splice in</span> +00243 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00244 <span class="comment"> */</span> +<a name="l00245"></a><a class="code" href="group__apr__ring.html#ga11">00245</a> <span class="preprocessor">#define APR_RING_SPLICE_AFTER(lep, ep1, epN, link) do { \</span> +00246 <span class="preprocessor"> APR_RING_PREV((ep1), link) = (lep); \</span> +00247 <span class="preprocessor"> APR_RING_NEXT((epN), link) = APR_RING_NEXT((lep), link); \</span> +00248 <span class="preprocessor"> APR_RING_PREV(APR_RING_NEXT((lep), link), link) = (epN); \</span> +00249 <span class="preprocessor"> APR_RING_NEXT((lep), link) = (ep1); \</span> +00250 <span class="preprocessor"> } while (0)</span> +00251 <span class="preprocessor"></span><span class="comment"></span> +00252 <span class="comment">/**</span> +00253 <span class="comment"> * Insert the element nep into the ring before element lep</span> +00254 <span class="comment"> * (..lep.. becomes ..nep..lep..)</span> +00255 <span class="comment"> * @warning This doesn't work for inserting before the first element or on</span> +00256 <span class="comment"> * empty rings... see APR_RING_INSERT_HEAD for one that does</span> +00257 <span class="comment"> * @param lep Element in the ring to insert before</span> +00258 <span class="comment"> * @param nep Element to insert</span> +00259 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00260 <span class="comment"> */</span> +<a name="l00261"></a><a class="code" href="group__apr__ring.html#ga12">00261</a> <span class="preprocessor">#define APR_RING_INSERT_BEFORE(lep, nep, link) \</span> +00262 <span class="preprocessor"> APR_RING_SPLICE_BEFORE((lep), (nep), (nep), link)</span> +00263 <span class="preprocessor"></span><span class="comment"></span> +00264 <span class="comment">/**</span> +00265 <span class="comment"> * Insert the element nep into the ring after element lep</span> +00266 <span class="comment"> * (..lep.. becomes ..lep..nep..)</span> +00267 <span class="comment"> * @warning This doesn't work for inserting after the last element or on</span> +00268 <span class="comment"> * empty rings... see APR_RING_INSERT_TAIL for one that does</span> +00269 <span class="comment"> * @param lep Element in the ring to insert after</span> +00270 <span class="comment"> * @param nep Element to insert</span> +00271 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00272 <span class="comment"> */</span> +<a name="l00273"></a><a class="code" href="group__apr__ring.html#ga13">00273</a> <span class="preprocessor">#define APR_RING_INSERT_AFTER(lep, nep, link) \</span> +00274 <span class="preprocessor"> APR_RING_SPLICE_AFTER((lep), (nep), (nep), link)</span> +00275 <span class="preprocessor"></span> +00276 <span class="comment"></span> +00277 <span class="comment">/**</span> +00278 <span class="comment"> * Splice the sequence ep1..epN into the ring before the first element</span> +00279 <span class="comment"> * (..hp.. becomes ..hp..ep1..epN..)</span> +00280 <span class="comment"> * @param hp Head of the ring</span> +00281 <span class="comment"> * @param ep1 First element in the sequence to splice in</span> +00282 <span class="comment"> * @param epN Last element in the sequence to splice in</span> +00283 <span class="comment"> * @param elem The name of the element struct</span> +00284 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00285 <span class="comment"> */</span> +<a name="l00286"></a><a class="code" href="group__apr__ring.html#ga14">00286</a> <span class="preprocessor">#define APR_RING_SPLICE_HEAD(hp, ep1, epN, elem, link) \</span> +00287 <span class="preprocessor"> APR_RING_SPLICE_AFTER(APR_RING_SENTINEL((hp), elem, link), \</span> +00288 <span class="preprocessor"> (ep1), (epN), link)</span> +00289 <span class="preprocessor"></span><span class="comment"></span> +00290 <span class="comment">/**</span> +00291 <span class="comment"> * Splice the sequence ep1..epN into the ring after the last element</span> +00292 <span class="comment"> * (..hp.. becomes ..ep1..epN..hp..)</span> +00293 <span class="comment"> * @param hp Head of the ring</span> +00294 <span class="comment"> * @param ep1 First element in the sequence to splice in</span> +00295 <span class="comment"> * @param epN Last element in the sequence to splice in</span> +00296 <span class="comment"> * @param elem The name of the element struct</span> +00297 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00298 <span class="comment"> */</span> +<a name="l00299"></a><a class="code" href="group__apr__ring.html#ga15">00299</a> <span class="preprocessor">#define APR_RING_SPLICE_TAIL(hp, ep1, epN, elem, link) \</span> +00300 <span class="preprocessor"> APR_RING_SPLICE_BEFORE(APR_RING_SENTINEL((hp), elem, link), \</span> +00301 <span class="preprocessor"> (ep1), (epN), link)</span> +00302 <span class="preprocessor"></span><span class="comment"></span> +00303 <span class="comment">/**</span> +00304 <span class="comment"> * Insert the element nep into the ring before the first element</span> +00305 <span class="comment"> * (..hp.. becomes ..hp..nep..)</span> +00306 <span class="comment"> * @param hp Head of the ring</span> +00307 <span class="comment"> * @param nep Element to insert</span> +00308 <span class="comment"> * @param elem The name of the element struct</span> +00309 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00310 <span class="comment"> */</span> +<a name="l00311"></a><a class="code" href="group__apr__ring.html#ga16">00311</a> <span class="preprocessor">#define APR_RING_INSERT_HEAD(hp, nep, elem, link) \</span> +00312 <span class="preprocessor"> APR_RING_SPLICE_HEAD((hp), (nep), (nep), elem, link)</span> +00313 <span class="preprocessor"></span><span class="comment"></span> +00314 <span class="comment">/**</span> +00315 <span class="comment"> * Insert the element nep into the ring after the last element</span> +00316 <span class="comment"> * (..hp.. becomes ..nep..hp..)</span> +00317 <span class="comment"> * @param hp Head of the ring</span> +00318 <span class="comment"> * @param nep Element to insert</span> +00319 <span class="comment"> * @param elem The name of the element struct</span> +00320 <span class="comment"> * @param link The name of the APR_RING_ENTRY in the element struct</span> +00321 <span class="comment"> */</span> +<a name="l00322"></a><a class="code" href="group__apr__ring.html#ga17">00322</a> <span class="preprocessor">#define APR_RING_INSERT_TAIL(hp, nep, elem, link) \</span> +00323 <span class="preprocessor"> APR_RING_SPLICE_TAIL((hp), (nep), (nep), elem, link)</span> +00324 <span class="preprocessor"></span><span class="comment"></span> +00325 <span class="comment">/**</span> +00326 <span class="comment"> * Concatenate ring h2 onto the end of ring h1, leaving h2 empty.</span> +00327 <span class="comment"> * @param h1 Head of the ring to concatenate onto</span> +00328 <span class="comment"> * @param h2 Head of the ring to concatenate</span> +00329 <span class="comment"> * @param elem The name of the element struct</span> +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 <stdio.h></span> +00385 <span class="preprocessor">#include <assert.h></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->next %p\n", \</span> +00400 <span class="preprocessor"> APR_RING_NEXT(here, link)); \</span> +00401 <span class="preprocessor"> fprintf(stderr, "\telem->prev %p\n", \</span> +00402 <span class="preprocessor"> APR_RING_PREV(here, link)); \</span> +00403 <span class="preprocessor"> fprintf(stderr, "\telem->next->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->prev->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->next->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->prev->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="http://www.doxygen.org/index.html"> -<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address> </body> </html>
Modified: apr/site/trunk/docs/docs/apr/apr__ring_8h.html URL: http://svn.apache.org/viewcvs/apr/site/trunk/docs/docs/apr/apr__ring_8h.html?view=diff&r1=151767&r2=151768 ============================================================================== --- apr/site/trunk/docs/docs/apr/apr__ring_8h.html (original) +++ apr/site/trunk/docs/docs/apr/apr__ring_8h.html Mon Feb 7 15:10:17 2005 @@ -3,9 +3,10 @@ <title>Apache Portable Runtime: apr_ring.h File Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> -<!-- Generated by Doxygen 1.3.8 --> +<!-- Generated by Doxygen 1.3.7 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> -<h1>apr_ring.h File Reference</h1>APR Rings. <a href="#_details">More...</a> +<h1>apr_ring.h File Reference</h1>APR Rings. +<a href="#_details">More...</a> <p> <code>#include "<a class="el" href="apr__general_8h-source.html">apr_general.h</a>"</code><br> @@ -71,8 +72,8 @@ <hr><a name="_details"></a><h2>Detailed Description</h2> APR Rings. <p> -<hr size="1"><address style="align: right;"><small>Generated on Wed Sep 1 21:36:05 2004 for Apache Portable Runtime by +<hr size="1"><address style="align: right;"><small>Generated on Mon Feb 7 13:18:25 2005 for Apache Portable Runtime by <a href="http://www.doxygen.org/index.html"> -<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address> </body> </html>