summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68>2002-02-28 23:23:29 +0000
committerjwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68>2002-02-28 23:23:29 +0000
commit45de6f4d7496e1c288320db7f951bad5f09da446 (patch)
tree383d546d250811fa6ff06d23dfb0669d25c17fd6
parent0274bae0b4232e5dd4bca4b6fa928592d1ec1b03 (diff)
downloadlibapr-45de6f4d7496e1c288320db7f951bad5f09da446.tar.gz
Add APR_RING_PREPEND() and APR_BRIGADE_PREPEND() as companions to _CONCAT()
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63072 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--include/apr_ring.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/apr_ring.h b/include/apr_ring.h
index 8002cdbbc..ebc1f3d78 100644
--- a/include/apr_ring.h
+++ b/include/apr_ring.h
@@ -326,6 +326,21 @@
} \
} while (0)
+/**
+ * Prepend ring h2 onto the beginning of ring h1, leaving h2 empty.
+ * @param h1 Head of the ring to prepend onto
+ * @param h2 Head of the ring to prepend
+ * @param elem The name of the element struct
+ * @param link The name of the APR_RING_ENTRY in the element struct
+ */
+#define APR_RING_PREPEND(h1, h2, elem, link) do { \
+ if (!APR_RING_EMPTY((h2), elem, link)) { \
+ APR_RING_SPLICE_AFTER(APR_RING_SENTINEL((h1), elem, link), \
+ APR_RING_FIRST((h2)), \
+ APR_RING_LAST((h2)), link); \
+ APR_RING_INIT((h2), elem, link); \
+ } \
+ } while (0)
/**
* Unsplice a sequence of elements from a ring