summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2016-08-16 11:00:50 +0200
committerAndreas Schneider <asn@samba.org>2016-10-20 10:50:22 +0200
commit97d23728cfc392fe5f2c33831f4c85aa31d083fc (patch)
tree901f67d2e0067ead4e862e0449253e051e4c9236 /src
parent087f9aea821cceffd3ced15b576106cace8a2c9d (diff)
downloadsocket_wrapper-97d23728cfc392fe5f2c33831f4c85aa31d083fc.tar.gz
socket_wrapper-97d23728cfc392fe5f2c33831f4c85aa31d083fc.tar.xz
socket_wrapper-97d23728cfc392fe5f2c33831f4c85aa31d083fc.zip
swrap: Add SWRAP_DLIST_ADD_AFTER macro
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'src')
-rw-r--r--src/socket_wrapper.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 5cb494c..2a88dff 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -184,6 +184,20 @@ enum swrap_dbglvl_e {
(item)->next = NULL; \
} while (0)
+#define SWRAP_DLIST_ADD_AFTER(list, item, el) \
+do { \
+ if ((list) != NULL || (el) != NULL) { \
+ SWRAP_DLIST_ADD(list, item); \
+ } else { \
+ (item)->prev = (el); \
+ (item)->next = (el)->next; \
+ (el)->next = (item); \
+ if ((item)->next != NULL) { \
+ (item)->next->prev = (item); \
+ } \
+ } \
+} while (0)
+
#if defined(HAVE_GETTIMEOFDAY_TZ) || defined(HAVE_GETTIMEOFDAY_TZ_VOID)
#define swrapGetTimeOfDay(tval) gettimeofday(tval,NULL)
#else