[Spice-devel] [PATCH 1/2] Remove extra '\n' from red_printf() calls

Dan McGee dpmcgee at gmail.com
Tue Feb 14 07:57:54 PST 2012


red_printf() takes care of adding a newline to all messages; remove the
extra newline from all messages and macros that were doubling them up.

Signed-off-by: Dan McGee <dpmcgee at gmail.com>
---
 common/spice_common.h |    2 +-
 server/dispatcher.c   |   12 ++++++------
 server/red_worker.c   |    2 +-
 server/snd_worker.c   |    2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/common/spice_common.h b/common/spice_common.h
index d13a94f..434b179 100644
--- a/common/spice_common.h
+++ b/common/spice_common.h
@@ -55,7 +55,7 @@
     }                                                               \
 } while (0)
 
-#define WARN(format, ...) red_printf("warning: "format"\n", ##__VA_ARGS__ );
+#define WARN(format, ...) red_printf("warning: "format, ##__VA_ARGS__ );
 #define WARN_ONCE red_printf_once
 
 #define red_printf_some(every, format, ...) do {                    \
diff --git a/server/dispatcher.c b/server/dispatcher.c
index b123fa8..94ae556 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -103,7 +103,7 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher)
     uint32_t ack = ACK;
 
     if ((ret = read_safe(dispatcher->recv_fd, &type, sizeof(type), 0)) == -1) {
-        red_printf("error reading from dispatcher: %d\n", errno);
+        red_printf("error reading from dispatcher: %d", errno);
         return 0;
     }
     if (ret == 0) {
@@ -112,19 +112,19 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher)
     }
     msg = &dispatcher->messages[type];
     if (read_safe(dispatcher->recv_fd, payload, msg->size, 1) == -1) {
-        red_printf("error reading from dispatcher: %d\n", errno);
+        red_printf("error reading from dispatcher: %d", errno);
         /* TODO: close socketpair? */
         return 0;
     }
     if (msg->handler) {
         msg->handler(dispatcher->opaque, (void *)payload);
     } else {
-        red_printf("error: no handler for message type %d\n", type);
+        red_printf("error: no handler for message type %d", type);
     }
     if (msg->ack == DISPATCHER_ACK) {
         if (write_safe(dispatcher->recv_fd,
                        &ack, sizeof(ack)) == -1) {
-            red_printf("error writing ack for message %d\n", type);
+            red_printf("error writing ack for message %d", type);
             /* TODO: close socketpair? */
         }
     } else if (msg->ack == DISPATCHER_ASYNC && dispatcher->handle_async_done) {
@@ -156,12 +156,12 @@ void dispatcher_send_message(Dispatcher *dispatcher, uint32_t message_type,
     msg = &dispatcher->messages[message_type];
     pthread_mutex_lock(&dispatcher->lock);
     if (write_safe(send_fd, &message_type, sizeof(message_type)) == -1) {
-        red_printf("error: failed to send message type for message %d\n",
+        red_printf("error: failed to send message type for message %d",
                    message_type);
         goto unlock;
     }
     if (write_safe(send_fd, payload, msg->size) == -1) {
-        red_printf("error: failed to send message body for message %d\n",
+        red_printf("error: failed to send message body for message %d",
                    message_type);
         goto unlock;
     }
diff --git a/server/red_worker.c b/server/red_worker.c
index 80fa825..4c73952 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -10465,7 +10465,7 @@ static void dev_destroy_primary_surface(RedWorker *worker, uint32_t surface_id)
     PANIC_ON(surface_id != 0);
 
     if (!worker->surfaces[surface_id].context.canvas) {
-        red_printf("double destroy of primary surface\n");
+        red_printf("double destroy of primary surface");
         return;
     }
 
diff --git a/server/snd_worker.c b/server/snd_worker.c
index e78d1d3..0e93a6f 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -204,7 +204,7 @@ static SndChannel *snd_channel_put(SndChannel *channel)
     if (!--channel->refs) {
         channel->worker->connection = NULL;
         free(channel);
-        red_printf("sound channel freed\n");
+        red_printf("sound channel freed");
         return NULL;
     }
     return channel;
-- 
1.7.9



More information about the Spice-devel mailing list