diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2026-05-09 17:56:53 +0200 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2026-05-09 17:56:53 +0200 |
| commit | 1f8a958cf61bc473bb0aa05a133ad40412910811 (patch) | |
| tree | b934c7ab6847599032c82b1c6d8bc2697cae44a6 /src/opt.c | |
| parent | 2dd4663ee68419059f327545e70095c4257b19e3 (diff) | |
New upstream version 5.4upstream
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 |
