Add missing do/while (0) on convenience macros

This commit is contained in:
Xavier Del Campo Romero 2020-10-08 08:47:15 +02:00
parent 083eca5323
commit 837c9427de
1 changed files with 4 additions and 2 deletions

View File

@ -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.