diff options
author | June McEnroe <june@causal.agency> | 2021-05-17 18:03:38 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-05-17 18:03:38 -0400 |
commit | 175fed4628acb9c46b073401c349a18154194ed7 (patch) | |
tree | cd3e64a000d650bccf4a581ea2a81d3873916960 /scoop.c | |
parent | Add scoop -r reverse flag (diff) | |
download | litterbox-175fed4628acb9c46b073401c349a18154194ed7.tar.gz litterbox-175fed4628acb9c46b073401c349a18154194ed7.zip |
Avoid VLAs
People don't like them. I'm still not sold on their dangers or whatever, but they're easy enough to avoid anyway.
Diffstat (limited to '')
-rw-r--r-- | scoop.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scoop.c b/scoop.c index 156d5c8..6d06499 100644 --- a/scoop.c +++ b/scoop.c @@ -365,7 +365,9 @@ int main(int argc, char *argv[]) { const char *limit = NULL; int n = 0; - struct Bind binds[argc + 2]; + struct Bind *binds = calloc(argc + 2, sizeof(*binds)); + if (!binds) err(EX_OSERR, "calloc"); + const char *Opts = "D:F:LN:ST:a:b:c:d:f:gh:l:m:n:pqrst:u:vw:"; for (int opt; 0 < (opt = getopt(argc, argv, Opts));) { switch (opt) { @@ -573,6 +575,7 @@ int main(int argc, char *argv[]) { dbBindInt(stmt, binds[i].param, binds[i].value); } } + free(binds); if (verbose) { char *expand = sqlite3_expanded_sql(stmt); |