Fix const qualifier discarded warnings in optlist_add_flags(),
mnt_opt_value_with(), and mnt_optstr_apply_flags() functions.
These warnings are reported by gcc 15 which defaults to the C23 standard.
The strchr() and strstr() functions return pointers into const strings,
so the receiving variables must be declared as const char *.
Signed-off-by: Karel Zak <kzak@redhat.com>
for (ent = map; ent && ent->name; ent++) {
- char *p;
+ const char *p;
size_t sz;
struct libmnt_opt *opt;
sz = p - ent->name;
p -= sz;
} else {
- p = (char *) ent->name;
+ p = ent->name;
sz = strlen(ent->name); /* alone "name" */
}
/* check if option value is @str or comma separated @str */
int mnt_opt_value_with(struct libmnt_opt *opt, const char *str)
{
- char *p;
- const char *start = opt->value;
+ const char *p, *start = opt->value;
size_t len;
if (!str || !opt->value || !*opt->value)
const struct libmnt_optmap *ent;
struct ul_buffer buf = UL_INIT_BUFFER;
size_t sz;
- char *p;
+ const char *p;
ul_buffer_refer_string(&buf, *optstr);