From: Ondřej Surý Date: Sun, 16 Feb 2020 16:34:24 +0000 (+0100) Subject: Fixup the missing clang-format bits X-Git-Tag: v9.16.1~51^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=649fe9be352d823ae72013f4f9a79b4f31736516;p=thirdparty%2Fbind9.git Fixup the missing clang-format bits (cherry picked from commit 3832e3ecc9854d83d65efe8fa49b258b4ce744e5) --- diff --git a/bin/dig/dig.c b/bin/dig/dig.c index bbe2fdfea59..358986fd500 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -42,12 +42,13 @@ #include #include -#define ADD_STRING(b, s) \ - { \ - if (strlen(s) >= isc_buffer_availablelength(b)) \ - return ((ISC_R_NOSPACE)); \ - else \ - isc_buffer_putstr(b, s); \ +#define ADD_STRING(b, s) \ + { \ + if (strlen(s) >= isc_buffer_availablelength(b)) { \ + return (ISC_R_NOSPACE); \ + } else { \ + isc_buffer_putstr(b, s); \ + } \ } #define DIG_MAX_ADDRESSES 20 diff --git a/lib/dns/message.c b/lib/dns/message.c index 08a230de006..4e4d692a479 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -938,9 +938,9 @@ getrdata(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, #define DO_ERROR(r) \ do { \ - if (best_effort) \ + if (best_effort) { \ seen_problem = true; \ - else { \ + } else { \ result = r; \ goto cleanup; \ } \ diff --git a/lib/dns/name.c b/lib/dns/name.c index 5632442f32b..831b534fb1d 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -99,9 +99,9 @@ static unsigned char maptolower[] = { var = (default_offsets); #define SETUP_OFFSETS(name, var, default_offsets) \ - if ((name)->offsets != NULL) \ + if ((name)->offsets != NULL) { \ var = (name)->offsets; \ - else { \ + } else { \ var = (default_offsets); \ set_offsets(name, var, NULL); \ } diff --git a/lib/isc/include/isc/list.h b/lib/isc/include/isc/list.h index bab6f1f619f..e686c9ba991 100644 --- a/lib/isc/include/isc/list.h +++ b/lib/isc/include/isc/list.h @@ -48,10 +48,11 @@ #define __ISC_LIST_PREPENDUNSAFE(list, elt, link) \ do { \ - if ((list).head != NULL) \ + if ((list).head != NULL) { \ (list).head->link.prev = (elt); \ - else \ + } else { \ (list).tail = (elt); \ + } \ (elt)->link.prev = NULL; \ (elt)->link.next = (list).head; \ (list).head = (elt); \ @@ -68,10 +69,11 @@ #define __ISC_LIST_APPENDUNSAFE(list, elt, link) \ do { \ - if ((list).tail != NULL) \ + if ((list).tail != NULL) { \ (list).tail->link.next = (elt); \ - else \ + } else { \ (list).head = (elt); \ + } \ (elt)->link.prev = (list).tail; \ (elt)->link.next = NULL; \ (list).tail = (elt); \ @@ -88,15 +90,15 @@ #define __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, type) \ do { \ - if ((elt)->link.next != NULL) \ + if ((elt)->link.next != NULL) { \ (elt)->link.next->link.prev = (elt)->link.prev; \ - else { \ + } else { \ ISC_INSIST((list).tail == (elt)); \ (list).tail = (elt)->link.prev; \ } \ - if ((elt)->link.prev != NULL) \ + if ((elt)->link.prev != NULL) { \ (elt)->link.prev->link.next = (elt)->link.next; \ - else { \ + } else { \ ISC_INSIST((list).head == (elt)); \ (list).head = (elt)->link.next; \ } \ @@ -122,9 +124,9 @@ #define __ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link) \ do { \ - if ((before)->link.prev == NULL) \ + if ((before)->link.prev == NULL) { \ ISC_LIST_PREPEND(list, elt, link); \ - else { \ + } else { \ (elt)->link.prev = (before)->link.prev; \ (before)->link.prev = (elt); \ (elt)->link.prev->link.next = (elt); \ @@ -141,9 +143,9 @@ #define __ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link) \ do { \ - if ((after)->link.next == NULL) \ + if ((after)->link.next == NULL) { \ ISC_LIST_APPEND(list, elt, link); \ - else { \ + } else { \ (elt)->link.next = (after)->link.next; \ (after)->link.next = (elt); \ (elt)->link.next->link.prev = (elt); \ @@ -160,9 +162,9 @@ #define ISC_LIST_APPENDLIST(list1, list2, link) \ do { \ - if (ISC_LIST_EMPTY(list1)) \ + if (ISC_LIST_EMPTY(list1)) { \ (list1) = (list2); \ - else if (!ISC_LIST_EMPTY(list2)) { \ + } else if (!ISC_LIST_EMPTY(list2)) { \ (list1).tail->link.next = (list2).head; \ (list2).head->link.prev = (list1).tail; \ (list1).tail = (list2).tail; \ @@ -173,9 +175,9 @@ #define ISC_LIST_PREPENDLIST(list1, list2, link) \ do { \ - if (ISC_LIST_EMPTY(list1)) \ + if (ISC_LIST_EMPTY(list1)) { \ (list1) = (list2); \ - else if (!ISC_LIST_EMPTY(list2)) { \ + } else if (!ISC_LIST_EMPTY(list2)) { \ (list2).tail->link.next = (list1).head; \ (list1).head->link.prev = (list2).tail; \ (list1).head = (list2).head; \ diff --git a/lib/isccc/include/isccc/util.h b/lib/isccc/include/isccc/util.h index 9a10fd5895a..f74c1604239 100644 --- a/lib/isccc/include/isccc/util.h +++ b/lib/isccc/include/isccc/util.h @@ -83,20 +83,21 @@ #define GETC16(v, w, d) \ do { \ GET8(v, w); \ - if (v == 0) \ + if (v == 0) { \ d = ISCCC_TRUE; \ - else { \ + } else { \ d = ISCCC_FALSE; \ if (v == 255) \ GET16(v, w); \ } \ } while (0) -#define GETC32(v, w) \ - do { \ - GET24(v, w); \ - if (v == 0xffffffu) \ - GET32(v, w); \ +#define GETC32(v, w) \ + do { \ + GET24(v, w); \ + if (v == 0xffffffu) { \ + GET32(v, w); \ + } \ } while (0) #define GET_OFFSET(v, w) GET32(v, w) @@ -111,10 +112,11 @@ do { \ GET8(v, w); \ if (v > 127) { \ - if (v < 255) \ + if (v < 255) { \ v = ((v & 0x7f) << 16) | ISCCC_RDATATYPE_SIG; \ - else \ + } else { \ GET32(v, w); \ + } \ } \ } while (0) @@ -161,21 +163,21 @@ w += 8; \ } while (0) -#define PUTC16(v, w) \ - do { \ - if (v > 0 && v < 255) \ - PUT8(v, w); \ - else { \ - PUT8(255, w); \ - PUT16(v, w); \ - } \ +#define PUTC16(v, w) \ + do { \ + if (v > 0 && v < 255) { \ + PUT8(v, w); \ + } else { \ + PUT8(255, w); \ + PUT16(v, w); \ + } \ } while (0) #define PUTC32(v, w) \ do { \ - if (v < 0xffffffU) \ + if (v < 0xffffffU) { \ PUT24(v, w); \ - else { \ + } else { \ PUT24(0xffffffU, w); \ PUT32(v, w); \ } \