]> Git Repo - qemu.git/blobdiff - slirp/misc.c
hw/arm: QOM'ify spitz.c
[qemu.git] / slirp / misc.c
index b8eb74cab03d86ded061e42daee30cf0405c9cf7..2fbd04856aaa70c7d92f993645af7283cc2aa88e 100644 (file)
@@ -5,21 +5,18 @@
  * terms and conditions of the copyright.
  */
 
+#include "qemu/osdep.h"
 #include <slirp.h>
 #include <libslirp.h>
 
 #include "monitor/monitor.h"
+#include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 
 #ifdef DEBUG
 int slirp_debug = DBG_CALL|DBG_MISC|DBG_ERROR;
 #endif
 
-struct quehead {
-       struct quehead *qh_link;
-       struct quehead *qh_rlink;
-};
-
 inline void
 insque(void *a, void *b)
 {
@@ -54,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;
 }
@@ -122,9 +119,9 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
        pid_t pid;
 
        DEBUG_CALL("fork_exec");
-       DEBUG_ARG("so = %lx", (long)so);
-       DEBUG_ARG("ex = %lx", (long)ex);
-       DEBUG_ARG("do_pty = %lx", (long)do_pty);
+       DEBUG_ARG("so = %p", so);
+       DEBUG_ARG("ex = %p", ex);
+       DEBUG_ARG("do_pty = %x", do_pty);
 
        if (do_pty == 2) {
                 return 0;
@@ -187,7 +184,7 @@ 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;
@@ -228,20 +225,6 @@ 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[] = {
This page took 0.026392 seconds and 4 git commands to generate.