size_t namesz;
};
-#define mnt_init_optloc(_ol) (memset((_ol), 0, sizeof(struct libmnt_optloc)))
+#define MNT_INIT_OPTLOC { .begin = NULL }
#define mnt_optmap_entry_novalue(e) \
(e && (e)->name && !strchr((e)->name, '=') && !((e)->mask & MNT_PREFIX))
int mnt_optstr_get_option(const char *optstr, const char *name,
char **value, size_t *valsz)
{
- struct libmnt_optloc ol;
+ struct libmnt_optloc ol = MNT_INIT_OPTLOC;
int rc;
if (!optstr || !name)
return -EINVAL;
- mnt_init_optloc(&ol);
-
rc = mnt_optstr_locate_option((char *) optstr, name, &ol);
if (!rc) {
if (value)
opt = *optstr;
do {
- struct libmnt_optloc ol;
-
- mnt_init_optloc(&ol);
+ struct libmnt_optloc ol = MNT_INIT_OPTLOC;
rc = mnt_optstr_locate_option(opt, name, &ol);
if (!rc) {
*/
int mnt_optstr_set_option(char **optstr, const char *name, const char *value)
{
- struct libmnt_optloc ol;
+ struct libmnt_optloc ol = MNT_INIT_OPTLOC;
char *nameend;
int rc = 1;
if (!optstr || !name)
return -EINVAL;
- mnt_init_optloc(&ol);
-
if (*optstr)
rc = mnt_optstr_locate_option(*optstr, name, &ol);
if (rc < 0)
*/
int mnt_optstr_remove_option(char **optstr, const char *name)
{
- struct libmnt_optloc ol;
+ struct libmnt_optloc ol = MNT_INIT_OPTLOC;
int rc;
if (!optstr || !name)
return -EINVAL;
- mnt_init_optloc(&ol);
-
rc = mnt_optstr_locate_option(*optstr, name, &ol);
if (rc != 0)
return rc;
int mnt_optstr_fix_user(char **optstr)
{
char *username;
- struct libmnt_optloc ol;
+ struct libmnt_optloc ol = MNT_INIT_OPTLOC;
int rc = 0;
DBG(CXT, ul_debug("fixing user"));
- mnt_init_optloc(&ol);
-
rc = mnt_optstr_locate_option(*optstr, "user", &ol);
if (rc)
return rc == 1 ? 0 : rc; /* 1: user= not found */