diff src/remote.c @ 495:c7a2471e5c4e

Introduce macros to display debug messages. if (debug) printf(...) is now replaced by variadic macros: DEBUG_1() And for higher debugging levels: DEBUG_2() DEBUG_3() DEBUG_4()
author zas_
date Wed, 23 Apr 2008 20:47:19 +0000
parents 48c8e49b571c
children fc9c8a3e1a8b
line wrap: on
line diff
--- a/src/remote.c	Wed Apr 23 13:46:18 2008 +0000
+++ b/src/remote.c	Wed Apr 23 20:47:19 2008 +0000
@@ -97,12 +97,8 @@
 		{
 		rc->clients = g_list_remove(rc->clients, client);
 
-		if (debug)
-			{
-			printf("HUP detected, closing client.\n");
-			printf("client count %d\n", g_list_length(rc->clients));
-			}
-
+		DEBUG_1("HUP detected, closing client.\nclient count %d\n", g_list_length(rc->clients));
+		
 		g_source_remove(client->channel_id);
 		close(client->fd);
 		g_free(client);
@@ -133,7 +129,7 @@
 	g_io_channel_unref(channel);
 
 	rc->clients = g_list_append(rc->clients, client);
-	if (debug) printf("client count %d\n", g_list_length(rc->clients));
+	DEBUG_1("client count %d\n", g_list_length(rc->clients));
 }
 
 static void remote_server_clients_close(RemoteConnection *rc)
@@ -256,7 +252,7 @@
 	strncpy(addr.sun_path, path, sun_path_len);
 	if (connect(fd, &addr, sizeof(addr)) == -1)
 		{
-		if (debug) printf("error connecting to socket: %s\n", strerror(errno));
+		DEBUG_1("error connecting to socket: %s\n", strerror(errno));
 		close(fd);
 		return NULL;
 		}