aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2020-10-08 08:47:15 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2020-10-08 11:24:31 +0200
commit837c9427de10ddcb5295f3840ead2a6c3aa61e69 (patch)
treef76b197a76e6231a2ac77f092cc68991fdb934bd
parent083eca5323a57f22847c578916e956321491a332 (diff)
Add missing do/while (0) on convenience macros
-rw-r--r--include/dynstr.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/dynstr.h b/include/dynstr.h
index b2e102c..79edc58 100644
--- a/include/dynstr.h
+++ b/include/dynstr.h
@@ -163,10 +163,11 @@ void dynstr_free(struct dynstr *d);
* Convenience macro that calls dynstr_append and returns its error code if failed.
*/
#define dynstr_append_or_ret(...) \
+ do \
{ \
const enum dynstr_err err = dynstr_append(__VA_ARGS__); \
if (err != DYNSTR_OK) return err; \
- }
+ } while (0)
/**
* Convenience macro that calls dynstr_append and returns zero if failed.
@@ -196,10 +197,11 @@ void dynstr_free(struct dynstr *d);
* Convenience macro that calls dynstr_prepend and returns its error code if failed.
*/
#define dynstr_prepend_or_ret(...) \
+ do \
{ \
const enum dynstr_err err = dynstr_prepend(__VA_ARGS__); \
if (err != DYNSTR_OK) return err; \
- }
+ } while (0)
/**
* Convenience macro that calls dynstr_prepend and returns zero if failed.