return &fstab;
}
-static void
-my_free(const void *s) {
- if (s)
- free((void *) s);
-}
-
static void
my_free_mc(struct mntentchn *mc) {
if (mc) {
if (streq(dr, dir))
ok = 1;
- my_free(dr);
+ free(dr);
if (!ok)
continue;
}
if (has_uuid(spec, fs + 5))
ok = 1;
}
- my_free(fs);
+ free(fs);
if (!ok)
continue;
}
else if (!strcmp(name,"UUID"))
mc = getfs_by_uuid (value);
- free((void *) name);
+ free(name);
return mc;
}
return 0;
}
-static void
-my_free(const void *s) {
- if (s)
- free((void *) s);
-}
-
/* Report on a single mount. */
static void
print_one (const struct my_mntent *me) {
mnt.mnt_type = fstab->m.mnt_type;
mnt.mnt_opts = fix_opts_string (flags, extra_opts, NULL);
mnt.mnt_freq = mnt.mnt_passno = 0;
- my_free(extra_opts);
+ free(extra_opts);
if (my_addmntent (mfp, &mnt) == 1) {
int errsv = errno;
if (verbose && status2)
printf (_("mount: giving up \"%s\"\n"), spec);
- my_free(opts);
+ free(opts);
+
my_free(node);
my_free(types);
exit (0); /* child stops here */
if (!mc && (devname || spec))
mc = getmntfile (devname ? devname : spec);
- if (devname)
- my_free(devname);
+ my_free(devname);
return mc;
}
extern void *xrealloc(void *p, size_t size);
extern char *xstrdup(const char *s);
+/*
+ * free(p); when 'p' is 'const char *' makes gcc unhappy:
+ * warning: passing argument 1 of ‘free’ discards qualifiers from pointer target type
+ */
+#define my_free(_p) free((void *) _p)
+
#endif /* MOUNT_XMALLOC_H */