mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 15:48:54 +02:00
gio-test: use g_debug rather than #define VERBOSE
This commit is contained in:
@@ -113,13 +113,11 @@ recv_message (GIOChannel *channel,
|
|||||||
gint fd = g_io_channel_unix_get_fd (channel);
|
gint fd = g_io_channel_unix_get_fd (channel);
|
||||||
gboolean retval = TRUE;
|
gboolean retval = TRUE;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
g_debug ("gio-test: ...from %d:%s%s%s%s", fd,
|
||||||
g_print ("gio-test: ...from %d:%s%s%s%s\n", fd,
|
|
||||||
(cond & G_IO_ERR) ? " ERR" : "",
|
(cond & G_IO_ERR) ? " ERR" : "",
|
||||||
(cond & G_IO_HUP) ? " HUP" : "",
|
(cond & G_IO_HUP) ? " HUP" : "",
|
||||||
(cond & G_IO_IN) ? " IN" : "",
|
(cond & G_IO_IN) ? " IN" : "",
|
||||||
(cond & G_IO_PRI) ? " PRI" : "");
|
(cond & G_IO_PRI) ? " PRI" : "");
|
||||||
#endif
|
|
||||||
|
|
||||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||||
{
|
{
|
||||||
@@ -140,9 +138,7 @@ recv_message (GIOChannel *channel,
|
|||||||
{
|
{
|
||||||
if (nb == 0)
|
if (nb == 0)
|
||||||
{
|
{
|
||||||
#ifdef VERBOSE
|
g_debug ("gio-test: ...from %d: EOF", fd);
|
||||||
g_print ("gio-test: ...from %d: EOF\n", fd);
|
|
||||||
#endif
|
|
||||||
shutdown_source (data);
|
shutdown_source (data);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -165,9 +161,7 @@ recv_message (GIOChannel *channel,
|
|||||||
|
|
||||||
if (nb == 0)
|
if (nb == 0)
|
||||||
{
|
{
|
||||||
#ifdef VERBOSE
|
g_debug ("gio-test: ...from %d: EOF", fd);
|
||||||
g_print ("gio-test: ...from %d: EOF\n", fd);
|
|
||||||
#endif
|
|
||||||
shutdown_source (data);
|
shutdown_source (data);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -176,9 +170,7 @@ recv_message (GIOChannel *channel,
|
|||||||
|
|
||||||
g_assert_cmpint (nbytes, <, BUFSIZE);
|
g_assert_cmpint (nbytes, <, BUFSIZE);
|
||||||
g_assert (nbytes >= 0 && nbytes < BUFSIZE);
|
g_assert (nbytes >= 0 && nbytes < BUFSIZE);
|
||||||
#ifdef VERBOSE
|
g_debug ("gio-test: ...from %d: %d bytes", fd, nbytes);
|
||||||
g_print ("gio-test: ...from %d: %d bytes\n", fd, nbytes);
|
|
||||||
#endif
|
|
||||||
if (nbytes > 0)
|
if (nbytes > 0)
|
||||||
{
|
{
|
||||||
error = read_all (fd, channel, buf, nbytes, &nb);
|
error = read_all (fd, channel, buf, nbytes, &nb);
|
||||||
@@ -188,18 +180,14 @@ recv_message (GIOChannel *channel,
|
|||||||
|
|
||||||
if (nb == 0)
|
if (nb == 0)
|
||||||
{
|
{
|
||||||
#ifdef VERBOSE
|
g_debug ("gio-test: ...from %d: EOF", fd);
|
||||||
g_print ("gio-test: ...from %d: EOF\n", fd);
|
|
||||||
#endif
|
|
||||||
shutdown_source (data);
|
shutdown_source (data);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < nbytes; j++)
|
for (j = 0; j < nbytes; j++)
|
||||||
g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
|
g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
|
||||||
#ifdef VERBOSE
|
g_debug ("gio-test: ...from %d: OK", fd);
|
||||||
g_print ("gio-test: ...from %d: OK\n", fd);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
@@ -404,10 +392,8 @@ main (int argc,
|
|||||||
buflen = rand() % BUFSIZE;
|
buflen = rand() % BUFSIZE;
|
||||||
for (j = 0; j < buflen; j++)
|
for (j = 0; j < buflen; j++)
|
||||||
buf[j] = ' ' + ((buflen + j) % 95);
|
buf[j] = ' ' + ((buflen + j) % 95);
|
||||||
#ifdef VERBOSE
|
g_debug ("gio-test: child writing %d+%d bytes to %d",
|
||||||
g_print ("gio-test: child writing %d+%d bytes to %d\n",
|
|
||||||
(int)(sizeof(i) + sizeof(buflen)), buflen, writefd);
|
(int)(sizeof(i) + sizeof(buflen)), buflen, writefd);
|
||||||
#endif
|
|
||||||
write (writefd, &i, sizeof (i));
|
write (writefd, &i, sizeof (i));
|
||||||
write (writefd, &buflen, sizeof (buflen));
|
write (writefd, &buflen, sizeof (buflen));
|
||||||
write (writefd, buf, buflen);
|
write (writefd, buf, buflen);
|
||||||
@@ -424,9 +410,7 @@ main (int argc,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
g_debug ("gio-test: child exiting, closing %d", writefd);
|
||||||
g_print ("gio-test: child exiting, closing %d\n", writefd);
|
|
||||||
#endif
|
|
||||||
close (writefd);
|
close (writefd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user