diff mbox series

[PULL,51/65] slirp: replace some fprintf() with DEBUG_MISC

Message ID 20190114000326.29847-52-samuel.thibault@ens-lyon.org (mailing list archive)
State New, archived
Headers show
Series [PULL,01/65] slirp: associate slirp_output callback with the Slirp context | expand

Commit Message

Samuel Thibault Jan. 14, 2019, 12:03 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Remove some clutter, and avoids direct call to fprintf().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 slirp/slirp.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/slirp/slirp.c b/slirp/slirp.c
index 7091c3998a..ce5f571d0f 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -164,9 +164,7 @@  static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr,
     if (!f)
         return -1;
 
-#ifdef DEBUG
-    fprintf(stderr, "IP address of your DNS(s): ");
-#endif
+    DEBUG_MISC("IP address of your DNS(s): ");
     while (fgets(buff, 512, f) != NULL) {
         if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) {
             char *c = strchr(buff2, '%');
@@ -188,15 +186,12 @@  static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr,
                     *scope_id = if_index;
                 }
                 *cached_time = curtime;
+            } else {
+                DEBUG_MISC(", ");
             }
-#ifdef DEBUG
-            else
-                fprintf(stderr, ", ");
-#endif
+
             if (++found > 3) {
-#ifdef DEBUG
-                fprintf(stderr, "(more)");
-#endif
+                DEBUG_MISC("(more)");
                 break;
             }
 #ifdef DEBUG
@@ -206,7 +201,7 @@  static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr,
                 if (!res) {
                     res = "(string conversion error)";
                 }
-                fprintf(stderr, "%s", res);
+                DEBUG_MISC("%s", res);
             }
 #endif
         }