aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--misc.c18
-rw-r--r--misc.h4
-rw-r--r--slirp_config.h3
3 files changed, 3 insertions, 22 deletions
diff --git a/misc.c b/misc.c
index 5762c20..2f0f7ca 100644
--- a/misc.c
+++ b/misc.c
@@ -51,11 +51,11 @@ int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec,
}
tmp_ptr = *ex_ptr;
- *ex_ptr = (struct ex_list *)malloc(sizeof(struct ex_list));
+ *ex_ptr = g_new(struct ex_list, 1);
(*ex_ptr)->ex_fport = port;
(*ex_ptr)->ex_addr = addr;
(*ex_ptr)->ex_pty = do_pty;
- (*ex_ptr)->ex_exec = (do_pty == 3) ? exec : strdup(exec);
+ (*ex_ptr)->ex_exec = (do_pty == 3) ? exec : g_strdup(exec);
(*ex_ptr)->ex_next = tmp_ptr;
return 0;
}
@@ -180,7 +180,7 @@ int fork_exec(struct socket *so, const char *ex, int do_pty)
bptr++;
c = *bptr;
*bptr++ = (char)0;
- argv[i++] = strdup(curarg);
+ argv[i++] = g_strdup(curarg);
} while (c);
argv[i] = NULL;
@@ -223,18 +223,6 @@ int fork_exec(struct socket *so, const char *ex, int do_pty)
}
#endif
-#ifndef HAVE_STRDUP
-char *strdup(str) const char *str;
-{
- char *bptr;
-
- bptr = (char *)malloc(strlen(str) + 1);
- strcpy(bptr, str);
-
- return bptr;
-}
-#endif
-
void slirp_connection_info(Slirp *slirp, Monitor *mon)
{
const char *const tcpstates[] = {
diff --git a/misc.h b/misc.h
index a205e2f..706e633 100644
--- a/misc.h
+++ b/misc.h
@@ -16,10 +16,6 @@ struct ex_list {
struct ex_list *ex_next;
};
-#ifndef HAVE_STRDUP
-char *strdup(const char *);
-#endif
-
#define EMU_NONE 0x0
/* TCP emulations */
diff --git a/slirp_config.h b/slirp_config.h
index 594c7af..7ee351e 100644
--- a/slirp_config.h
+++ b/slirp_config.h
@@ -73,9 +73,6 @@
/* Define if you have strerror */
#define HAVE_STRERROR
-/* Define if you have strdup() */
-#define HAVE_STRDUP
-
/* Define according to how time.h should be included */
#define TIME_WITH_SYS_TIME 0
#undef HAVE_SYS_TIME_H