[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33955 - libmicrohttpd/src/microhttpd
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33955 - libmicrohttpd/src/microhttpd |
Date: |
Sat, 12 Jul 2014 20:57:56 +0200 |
Author: grothoff
Date: 2014-07-12 20:57:56 +0200 (Sat, 12 Jul 2014)
New Revision: 33955
Modified:
libmicrohttpd/src/microhttpd/connection.c
libmicrohttpd/src/microhttpd/internal.h
Log:
code cleanup, expand assertions
Modified: libmicrohttpd/src/microhttpd/connection.c
===================================================================
--- libmicrohttpd/src/microhttpd/connection.c 2014-07-11 22:10:15 UTC (rev
33954)
+++ libmicrohttpd/src/microhttpd/connection.c 2014-07-12 18:57:56 UTC (rev
33955)
@@ -2003,7 +2003,7 @@
connection->last_activity = MHD_monotonic_time();
if (connection->connection_timeout != daemon->connection_timeout)
- return; /* custom timeout, no need to move it in DLL */
+ return; /* custom timeout, no need to move it in "normal" DLL */
/* move connection to head of timeout list (by remove + add operation) */
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
Modified: libmicrohttpd/src/microhttpd/internal.h
===================================================================
--- libmicrohttpd/src/microhttpd/internal.h 2014-07-11 22:10:15 UTC (rev
33954)
+++ libmicrohttpd/src/microhttpd/internal.h 2014-07-12 18:57:56 UTC (rev
33955)
@@ -541,6 +541,10 @@
/**
* Next pointer for the XDLL organizing connections by timeout.
+ * This DLL can be either the
+ * 'manual_timeout_head/manual_timeout_tail' or the
+ * 'normal_timeout_head/normal_timeout_tail', depending on whether a
+ * custom timeout is set for the connection.
*/
struct MHD_Connection *nextX;
@@ -1258,7 +1262,7 @@
#if EXTRA_CHECKS
-#define EXTRA_CHECK(a) if (!(a)) abort();
+#define EXTRA_CHECK(a) do { if (!(a)) abort(); } while (0)
#else
#define EXTRA_CHECK(a)
#endif
@@ -1273,6 +1277,8 @@
* @param element element to insert
*/
#define DLL_insert(head,tail,element) do { \
+ EXTRA_CHECK (NULL == (element)->next); \
+ EXTRA_CHECK (NULL == (element)->prev); \
(element)->next = (head); \
(element)->prev = NULL; \
if ((tail) == NULL) \
@@ -1292,6 +1298,8 @@
* @param element element to remove
*/
#define DLL_remove(head,tail,element) do { \
+ EXTRA_CHECK ( (NULL != (element)->next) || ((element) == (tail))); \
+ EXTRA_CHECK ( (NULL != (element)->prev) || ((element) == (head))); \
if ((element)->prev == NULL) \
(head) = (element)->next; \
else \
@@ -1314,9 +1322,11 @@
* @param element element to insert
*/
#define XDLL_insert(head,tail,element) do { \
+ EXTRA_CHECK (NULL == (element)->nextX); \
+ EXTRA_CHECK (NULL == (element)->prevX); \
(element)->nextX = (head); \
(element)->prevX = NULL; \
- if ((tail) == NULL) \
+ if (NULL == (tail)) \
(tail) = element; \
else \
(head)->prevX = element; \
@@ -1333,11 +1343,13 @@
* @param element element to remove
*/
#define XDLL_remove(head,tail,element) do { \
- if ((element)->prevX == NULL) \
+ EXTRA_CHECK ( (NULL != (element)->nextX) || ((element) == (tail))); \
+ EXTRA_CHECK ( (NULL != (element)->prevX) || ((element) == (head))); \
+ if (NULL == (element)->prevX) \
(head) = (element)->nextX; \
else \
(element)->prevX->nextX = (element)->nextX; \
- if ((element)->nextX == NULL) \
+ if (NULL == (element)->nextX) \
(tail) = (element)->prevX; \
else \
(element)->nextX->prevX = (element)->prevX; \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33955 - libmicrohttpd/src/microhttpd,
gnunet <=