summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util/dlinklist.h24
-rw-r--r--src/util/sss_python.h5
-rw-r--r--src/util/util_safealign.h6
3 files changed, 24 insertions, 11 deletions
diff --git a/src/util/dlinklist.h b/src/util/dlinklist.h
index e8490496c..4f6aef830 100644
--- a/src/util/dlinklist.h
+++ b/src/util/dlinklist.h
@@ -43,12 +43,20 @@ do { \
do { \
if ((p) == (list)) { \
(list) = (p)->next; \
- if (list) (list)->prev = NULL; \
+ if (list) { \
+ (list)->prev = NULL; \
+ } \
} else { \
- if ((p)->prev) (p)->prev->next = (p)->next; \
- if ((p)->next) (p)->next->prev = (p)->prev; \
+ if ((p)->prev) { \
+ (p)->prev->next = (p)->next; \
+ } \
+ if ((p)->next) { \
+ (p)->next->prev = (p)->prev; \
+ } \
+ } \
+ if ((p) != (list)) { \
+ (p)->next = (p)->prev = NULL; \
} \
- if ((p) != (list)) (p)->next = (p)->prev = NULL; \
} while (0)
/* promote an element to the top of the list */
@@ -85,7 +93,9 @@ do { \
p->prev = el; \
p->next = el->next; \
el->next = p; \
- if (p->next) p->next->prev = p; \
+ if (p->next) { \
+ p->next->prev = p; \
+ } \
} \
} while (0)
@@ -128,7 +138,9 @@ do { \
(list2)->prev = (el); \
tmp->next = (el)->next; \
(el)->next = (list2); \
- if (tmp->next != NULL) tmp->next->prev = tmp; \
+ if (tmp->next != NULL) { \
+ tmp->next->prev = tmp; \
+ } \
} \
} while (0);
diff --git a/src/util/sss_python.h b/src/util/sss_python.h
index 7e2bac336..b3fdaad64 100644
--- a/src/util/sss_python.h
+++ b/src/util/sss_python.h
@@ -31,8 +31,9 @@ sss_exception_with_doc(char *name, char *doc, PyObject *base, PyObject *dict);
/* Convenience macros */
#define TYPE_READY(module, type, name) do { \
- if (PyType_Ready(&type) < 0) \
- MODINITERROR; \
+ if (PyType_Ready(&type) < 0) { \
+ MODINITERROR; \
+ } \
Py_INCREF(&type); \
PyModule_AddObject(module, \
discard_const_p(char, name), \
diff --git a/src/util/util_safealign.h b/src/util/util_safealign.h
index ba216f606..b1c9f8a0c 100644
--- a/src/util/util_safealign.h
+++ b/src/util/util_safealign.h
@@ -103,19 +103,19 @@ safealign_memcpy(void *dest, const void *src, size_t n, size_t *counter)
* would excceed len. */
#define SAFEALIGN_COPY_UINT32_CHECK(dest, src, len, pctr) do { \
if ((*(pctr) + sizeof(uint32_t)) > (len) || \
- SIZE_T_OVERFLOW(*(pctr), sizeof(uint32_t))) return EINVAL; \
+ SIZE_T_OVERFLOW(*(pctr), sizeof(uint32_t))) { return EINVAL; } \
safealign_memcpy(dest, src, sizeof(uint32_t), pctr); \
} while(0)
#define SAFEALIGN_COPY_INT32_CHECK(dest, src, len, pctr) do { \
if ((*(pctr) + sizeof(int32_t)) > (len) || \
- SIZE_T_OVERFLOW(*(pctr), sizeof(int32_t))) return EINVAL; \
+ SIZE_T_OVERFLOW(*(pctr), sizeof(int32_t))) { return EINVAL; } \
safealign_memcpy(dest, src, sizeof(int32_t), pctr); \
} while(0)
#define SAFEALIGN_COPY_UINT16_CHECK(dest, src, len, pctr) do { \
if ((*(pctr) + sizeof(uint16_t)) > (len) || \
- SIZE_T_OVERFLOW(*(pctr), sizeof(uint16_t))) return EINVAL; \
+ SIZE_T_OVERFLOW(*(pctr), sizeof(uint16_t))) { return EINVAL; } \
safealign_memcpy(dest, src, sizeof(uint16_t), pctr); \
} while(0)