summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2023-01-28 11:27:40 +0100
committerNRK <nrk@disroot.org>2023-01-28 11:27:40 +0100
commit01f3cf2e4778940a82001e48cfeec767841f52c4 (patch)
tree7d61272eb5c71935238d0ecd52b2806398564fce /util.c
parent6ffc64a04e5e4200103db9df6bd85f958a942d9f (diff)
downloadnsxiv-01f3cf2e4778940a82001e48cfeec767841f52c4.tar.zst
use assertions instead of ignoring bogus arguments (#406)
instead of silently ignoring bogus arguments (i.e programming errors), which can make debugging harder, it's better to assert them so that they get caught faster in debug builds. Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/406 Reviewed-by: explosion-mental <explosion-mental@noreply.codeberg.org>
Diffstat (limited to 'util.c')
-rw-r--r--util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/util.c b/util.c
index cfe64c6..94d4247 100644
--- a/util.c
+++ b/util.c
@@ -226,8 +226,7 @@ void construct_argv(char **argv, unsigned int len, ...)
for (i = 0; i < len; ++i)
argv[i] = va_arg(args, char *);
va_end(args);
- if (argv[len-1] != NULL)
- error(EXIT_FAILURE, 0, "argv not NULL terminated");
+ assert(argv[len-1] == NULL && "argv should be NULL terminated");
}
static int mkspawn_pipe(posix_spawn_file_actions_t *fa, const char *cmd, int *pfd, int dupidx)