@@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <string.h>
#include "log_pthread.h"
#include <sys/types.h>
@@ -7,20 +7,3 @@
#include "memory.h"
const char * const default_partition_delim = DEFAULT_PARTITION_DELIM;
-
-char *
-set_default (char * str)
-{
- int len;
- char * p;
-
- len = strlen(str);
- p = MALLOC(len + 1);
-
- if (!p)
- return NULL;
-
- strncat(p, str, len);
-
- return p;
-}
@@ -1,3 +1,5 @@
+#ifndef _DEFAULTS_H
+#define _DEFAULTS_H
/*
* If you add or modify a value also update multipath/multipath.conf.5
* and the TEMPLATE in libmultipath/hwtable.c
@@ -60,5 +62,10 @@
#define DEFAULT_CONFIG_DIR "/etc/multipath/conf.d"
#define MULTIPATH_SHM_BASE "/dev/shm/multipath/"
-char * set_default (char * str);
+
+static inline char *set_default(char *str)
+{
+ return strdup(str);
+}
extern const char *const default_partition_delim;
+#endif /* _DEFAULTS_H */
This is nothing but a reimplementation of strdup(), and it causes gcc 9 warnings. Remove it. Signed-off-by: Martin Wilck <mwilck@suse.com> --- libmultipath/debug.c | 1 + libmultipath/defaults.c | 17 ----------------- libmultipath/defaults.h | 9 ++++++++- 3 files changed, 9 insertions(+), 18 deletions(-)