summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-09-10 18:27:47 -0500
committerPaul Eggert <eggert@cs.ucla.edu>2022-09-10 18:27:47 -0500
commit6fba6e940684a4e6bd8d924d2d49f16de824251c (patch)
tree34abbd97074a40502aaf4a9a4c6575b0707d1882
parent2dedbc606b58031b0f8263ebcf6eba1c3dfc5026 (diff)
downloadpaxutils-6fba6e940684a4e6bd8d924d2d49f16de824251c.tar.gz
Package PRINT_INT inside do-while
* tests/genfile.c (PRINT_INT): Put statement body inside do-while to avoid if-else issues.
-rw-r--r--tests/genfile.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/genfile.c b/tests/genfile.c
index 4c7c745..f02890d 100644
--- a/tests/genfile.c
+++ b/tests/genfile.c
@@ -618,16 +618,20 @@ generate_sparse_file (int argc, char **argv)
/* Status Mode */
#define PRINT_INT(expr) \
- if (EXPR_SIGNED (expr)) \
+ do \
{ \
- intmax_t printval = expr; \
- printf ("%jd", printval); \
+ if (EXPR_SIGNED (expr)) \
+ { \
+ intmax_t printval = expr; \
+ printf ("%jd", printval); \
+ } \
+ else \
+ { \
+ uintmax_t printval = expr; \
+ printf ("%ju", printval); \
+ } \
} \
- else \
- { \
- uintmax_t printval = expr; \
- printf ("%ju", printval); \
- }
+ while (false)
void
print_time (time_t t)