aboutsummaryrefslogtreecommitdiff
path: root/dynstr.c
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavier.delcampo@orain.io>2020-09-03 14:57:05 +0200
committerXavier Del Campo Romero <xavier.delcampo@orain.io>2020-09-03 15:42:56 +0200
commit4c7bfbf87f05e9df16a34198098806e1ac029be9 (patch)
treed753173b000c66226322780c25f8ac178905a960 /dynstr.c
parent9b85c4beaad6560e810f662d99215f1450c6a74f (diff)
downloaddynstr-4c7bfbf87f05e9df16a34198098806e1ac029be9.tar.gz
Avoid potential undesirable effects caused by macros
The macros provided by this library would expand to an unguarded conditional that could have potential unwanted consequences. Consider the following example: dynstr_append_or_ret_null(&d, "example"); else { /* This is unexpectedly working. */ } The example above would expand to: if (dynstr_append(__VA_ARGS__) != DYNSTR_OK) return false; else { /* This is unexpectedly working. */ } Which is valid C yet allows possibly unexpected behaviour. The solution is then to enclose these conditions into a `do while (0)` statement.
Diffstat (limited to 'dynstr.c')
0 files changed, 0 insertions, 0 deletions