summaryrefslogtreecommitdiff
path: root/libbcachefs.c
diff options
context:
space:
mode:
authorBrett Holman <bpholman5@gmail.com>2021-05-19 21:07:47 -0600
committerKent Overstreet <kent.overstreet@gmail.com>2021-05-19 23:26:13 -0400
commit9c0dc7b8d42e380e15822cc00d70958f8f10e0f3 (patch)
tree6e650c081c1e80c8b442755278711a409ed81a17 /libbcachefs.c
parent2e2d5a3f7ed4f6d4e2a45011a82386ba82cd3976 (diff)
minor fixes for clang support
Diffstat (limited to 'libbcachefs.c')
-rw-r--r--libbcachefs.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/libbcachefs.c b/libbcachefs.c
index fbcb237f..65ca07e2 100644
--- a/libbcachefs.c
+++ b/libbcachefs.c
@@ -1100,22 +1100,17 @@ struct bch_opts bch2_parse_opts(struct bch_opt_strs strs)
return opts;
}
+#define newline(c) \
+ do { \
+ printf("\n"); \
+ c = 0; \
+ } while(0)
void bch2_opts_usage(unsigned opt_types)
{
const struct bch_option *opt;
unsigned i, c = 0, helpcol = 30;
- void tabalign() {
- while (c < helpcol) {
- putchar(' ');
- c++;
- }
- }
- void newline() {
- printf("\n");
- c = 0;
- }
for (opt = bch2_opt_table;
opt < bch2_opt_table + bch2_opts_nr;
@@ -1146,21 +1141,24 @@ void bch2_opts_usage(unsigned opt_types)
const char *l = opt->help;
if (c >= helpcol)
- newline();
+ newline(c);
while (1) {
const char *n = strchrnul(l, '\n');
- tabalign();
+ while (c < helpcol) {
+ putchar(' ');
+ c++;
+ }
printf("%.*s", (int) (n - l), l);
- newline();
+ newline(c);
if (!*n)
break;
l = n + 1;
}
} else {
- newline();
+ newline(c);
}
}
}