[Spice-commits] 2 commits - common/spice_common.h server/dispatcher.c server/red_worker.c server/snd_worker.c server/tests
Alon Levy
alon at kemper.freedesktop.org
Tue Feb 14 08:20:20 PST 2012
common/spice_common.h | 2 +-
server/dispatcher.c | 12 ++++++------
server/red_worker.c | 2 +-
server/snd_worker.c | 2 +-
server/tests/basic_event_loop.c | 2 +-
server/tests/test_display_base.c | 6 +++---
server/tests/test_empty_success.c | 4 ++--
7 files changed, 15 insertions(+), 15 deletions(-)
New commits:
commit 3f303d6014a53d2250aeb8c86aa5038f98f2e83c
Author: Dan McGee <dpmcgee at gmail.com>
Date: Tue Feb 14 09:57:55 2012 -0600
Remove all usages of bzero()
As recommended by modern C practice, we should just be using memset().
Signed-off-by: Dan McGee <dpmcgee at gmail.com>
diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
index c0ee705..70eb026 100644
--- a/server/tests/basic_event_loop.c
+++ b/server/tests/basic_event_loop.c
@@ -267,7 +267,7 @@ SpiceCoreInterface *basic_event_loop_init(void)
{
ring_init(&watches);
ring_init(&timers);
- bzero(&core, sizeof(core));
+ memset(&core, 0, sizeof(core));
core.base.major_version = SPICE_INTERFACE_CORE_MAJOR;
core.base.minor_version = SPICE_INTERFACE_CORE_MINOR; // anything less then 3 and channel_event isn't called
core.timer_add = timer_add;
diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 811e901..63cbf2f 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -339,7 +339,7 @@ static void set_mm_time(QXLInstance *qin, uint32_t mm_time)
static void get_init_info(QXLInstance *qin, QXLDevInitInfo *info)
{
- bzero(info, sizeof(*info));
+ memset(info, 0, sizeof(*info));
info->num_memslots = 1;
info->num_memslots_groups = 1;
info->memslot_id_bits = 1;
@@ -644,8 +644,8 @@ SpiceServer* test_init(SpiceCoreInterface *core)
spice_server_init(server, core);
path_init(&path, 0, angle_parts);
- bzero(primary_surface, sizeof(primary_surface));
- bzero(secondary_surface, sizeof(secondary_surface));
+ memset(primary_surface, 0, sizeof(primary_surface));
+ memset(secondary_surface, 0, sizeof(secondary_surface));
has_secondary = 0;
wakeup_timer = core->timer_add(do_wakeup, NULL);
return server;
diff --git a/server/tests/test_empty_success.c b/server/tests/test_empty_success.c
index 435efbf..ccabe6b 100644
--- a/server/tests/test_empty_success.c
+++ b/server/tests/test_empty_success.c
@@ -1,6 +1,6 @@
#include <config.h>
#include <stdlib.h>
-#include <strings.h>
+#include <string.h>
#include <spice.h>
@@ -43,7 +43,7 @@ int main(void)
SpiceServer *server = spice_server_new();
SpiceCoreInterface core;
- bzero(&core, sizeof(core));
+ memset(&core, 0, sizeof(core));
core.base.major_version = SPICE_INTERFACE_CORE_MAJOR;
core.timer_add = timer_add;
core.timer_start = timer_start;
commit 08c514ee853444ab158aa461b07b1921bb931a29
Author: Dan McGee <dpmcgee at gmail.com>
Date: Tue Feb 14 09:57:54 2012 -0600
Remove extra '\n' from red_printf() calls
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>
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;
More information about the Spice-commits
mailing list