summaryrefslogtreecommitdiffhomepage
path: root/ir/libcore
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2012-09-21 13:54:25 +0200
committerMatthias Braun <matze@braunis.de>2012-10-24 13:47:31 +0200
commit64fe0a138b8ebab4633fb47ed7e8b20d41f41491 (patch)
treeff9dbc58a96a85faab7ccadee77d075091b57296 /ir/libcore
parent5c2b81187fdff8978610ec4b85661cc5f6f1247c (diff)
fix a bunch of warnings reported by clang analyzer
Diffstat (limited to 'ir/libcore')
-rw-r--r--ir/libcore/lc_opts.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ir/libcore/lc_opts.c b/ir/libcore/lc_opts.c
index 48fa148..5d34a93 100644
--- a/ir/libcore/lc_opts.c
+++ b/ir/libcore/lc_opts.c
@@ -699,14 +699,14 @@ int lc_opt_from_single_arg(const lc_opt_entry_t *root,
{
const lc_opt_entry_t *grp = root;
size_t n = strlen(arg);
- size_t n_prefix = opt_prefix ? strlen(opt_prefix) : 0;
+ size_t n_prefix = opt_prefix != NULL ? strlen(opt_prefix) : 0;
int error = 0;
int ret = 0;
lc_opt_err_info_t err;
const char *end, *eqsign;
- if (n >= n_prefix && strncmp(opt_prefix, arg, n_prefix) == 0) {
+ if (n >= n_prefix && (n_prefix == 0 || strncmp(opt_prefix, arg, n_prefix) == 0)) {
arg = arg + n_prefix;
/* find the next delimiter (the -) and extract the string up to