From 1f8a958cf61bc473bb0aa05a133ad40412910811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 9 May 2026 17:56:53 +0200 Subject: New upstream version 5.4 --- src/opt.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/opt.c') diff --git a/src/opt.c b/src/opt.c index 118c159..6e3d032 100644 --- a/src/opt.c +++ b/src/opt.c @@ -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 #include #include @@ -15,6 +18,9 @@ #include #include #include +#ifdef HAVE_STRINGS_H +# include +#endif #include #include #include @@ -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 -- cgit v1.2.3