qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: [Qemu-devel] [PATCH] Strip trailing '\n' from error_report()'s first argument (again)
Date: Tue, 20 Dec 2011 18:13:08 +0100	[thread overview]
Message-ID: <1324401188-9712-1-git-send-email-armbru@redhat.com> (raw)

Commit 6daf194d got rid of them, but Hans and Gerd added some more
lately.  Tracked down with this Coccinelle semantic patch:

@r@
    expression fmt;
    position p;
@@
    error_report(fmt, ...)@p
@script:python@
    fmt << r.fmt;
    p << r.p;
@@
if "\\n" in str(fmt):
    print "%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt)

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/usb-bus.c |   12 ++++++------
 usb-redir.c  |    4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 8203390..bd4afa7 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -137,7 +137,7 @@ USBDevice *usb_create(USBBus *bus, const char *name)
         bus = usb_bus_find(-1);
         if (!bus)
             return NULL;
-        error_report("%s: no bus specified, using \"%s\" for \"%s\"\n",
+        error_report("%s: no bus specified, using \"%s\" for \"%s\"",
                 __FUNCTION__, bus->qbus.name, name);
     }
 #endif
@@ -152,12 +152,12 @@ USBDevice *usb_create_simple(USBBus *bus, const char *name)
     int rc;
 
     if (!dev) {
-        error_report("Failed to create USB device '%s'\n", name);
+        error_report("Failed to create USB device '%s'", name);
         return NULL;
     }
     rc = qdev_init(&dev->qdev);
     if (rc < 0) {
-        error_report("Failed to initialize USB device '%s'\n", name);
+        error_report("Failed to initialize USB device '%s'", name);
         return NULL;
     }
     return dev;
@@ -244,7 +244,7 @@ int usb_claim_port(USBDevice *dev)
             }
         }
         if (port == NULL) {
-            error_report("Error: usb port %s (bus %s) not found (in use?)\n",
+            error_report("Error: usb port %s (bus %s) not found (in use?)",
                          dev->port_path, bus->qbus.name);
             return -1;
         }
@@ -255,7 +255,7 @@ int usb_claim_port(USBDevice *dev)
         }
         if (bus->nfree == 0) {
             error_report("Error: tried to attach usb device %s to a bus "
-                         "with no free ports\n", dev->product_desc);
+                         "with no free ports", dev->product_desc);
             return -1;
         }
         port = QTAILQ_FIRST(&bus->free);
@@ -302,7 +302,7 @@ int usb_device_attach(USBDevice *dev)
 
     if (!(port->speedmask & dev->speedmask)) {
         error_report("Warning: speed mismatch trying to attach "
-                     "usb device %s to bus %s\n",
+                     "usb device %s to bus %s",
                      dev->product_desc, bus->qbus.name);
         return -1;
     }
diff --git a/usb-redir.c b/usb-redir.c
index a36f2a7..2b53cf3 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -174,7 +174,7 @@ static void usbredir_log(void *priv, int level, const char *msg)
         return;
     }
 
-    error_report("%s\n", msg);
+    error_report("%s", msg);
 }
 
 static void usbredir_log_data(USBRedirDevice *dev, const char *desc,
@@ -193,7 +193,7 @@ static void usbredir_log_data(USBRedirDevice *dev, const char *desc,
         for (j = 0; j < 8 && i + j < len; j++) {
             n += sprintf(buf + n, " %02X", data[i + j]);
         }
-        error_report("%s\n", buf);
+        error_report("%s", buf);
     }
 }
 
-- 
1.7.6.4

             reply	other threads:[~2011-12-20 17:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20 17:13 Markus Armbruster [this message]
2011-12-21 11:01 ` [Qemu-devel] [Qemu-trivial] [PATCH] Strip trailing '\n' from error_report()'s first argument (again) Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324401188-9712-1-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).