diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2026-05-09 17:57:12 +0200 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2026-05-09 17:57:12 +0200 |
| commit | d71ca4876dbd4c68dae05cf55b7d24de3a09b7ed (patch) | |
| tree | 36fd5957c604f96e283229e0429aed345b4c5583 /src/opt.c | |
| parent | 9a01a96702fcc37ed10d0bece56bfddf4387b274 (diff) | |
| parent | 15612a69dd5bb9dbad09e7095dc69ba96997c23b (diff) | |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/opt.c')
| -rw-r--r-- | src/opt.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -7,6 +7,9 @@ * General Public License as published by the Free Software Foundation; * either version 2.1 or (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include <errno.h> #include <limits.h> #include <stdbool.h> @@ -15,6 +18,9 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif #include <libHX/ctype_helper.h> #include <libHX/deque.h> #include <libHX/map.h> @@ -561,13 +567,13 @@ static int HX_getopt_long(const char *cur, struct HX_getopt_vars *par) return -EINVAL; } *value = '\0'; - value = strchr(cur, '='); - if (value == nullptr) { + const char *cvalue = strchr(cur, '='); + if (cvalue == nullptr) { /* Cannot happen either */ free(key); return -EINVAL; } - ++value; + ++cvalue; par->cbi.current = lookup_long_pfx(par->cbi.table, key + 2); if (par->cbi.current == &HXopt_ambig_prefix) { ret = HX_getopt_error(HXOPT_E_AMBIG_PREFIX, key, par->flags); @@ -591,7 +597,7 @@ static int HX_getopt_long(const char *cur, struct HX_getopt_vars *par) free(key); par->cbi.flags = HXOPTCB_BY_LONG; - par->cbi.data = value; + par->cbi.data = const_cast(char *, cvalue); /* * Not possible to use %HXOPT_I_ASSIGN due to transience of @key. Thus * manually call do_assign now rather than in the superordinate |
