diff mbox series

[v2,for-3.2,v2,16/30] slirp: replace some fprintf() with DEBUG_MISC

Message ID 20181121220647.18844-17-marcandre.lureau@redhat.com
State New
Headers show
Series slirp: make it again a standalone project | expand

Commit Message

Marc-André Lureau Nov. 21, 2018, 10:06 p.m. UTC
Remove some clutter, and avoids direct call to fprintf().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 slirp/slirp.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

Comments

Samuel Thibault Nov. 21, 2018, 10:29 p.m. UTC | #1
Marc-André Lureau, le jeu. 22 nov. 2018 02:06:33 +0400, a ecrit:
> Remove some clutter, and avoids direct call to fprintf().
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Applied to my tree, thanks!
diff mbox series

Patch

diff --git a/slirp/slirp.c b/slirp/slirp.c
index 76b1f2f3e0..432adb02c4 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -163,9 +163,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, '%');
@@ -187,15 +185,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
@@ -205,7 +200,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
         }