From afc9506e9e4b25c12c50e82647f45d8411dbe3f8 Mon Sep 17 00:00:00 2001 From: Jens Granseuer Date: Wed, 23 Jan 2008 22:22:27 +0000 Subject: [PATCH] Only declare variables at the beginning of a code block. Bug #511654. 2008-01-23 Jens Granseuer * glib/gtestutils.c: (g_test_trap_fork): * glib/tests/testing.c: (test_assertions): Only declare variables at the beginning of a code block. Bug #511654. svn path=/trunk/; revision=6361 --- ChangeLog | 6 ++++++ glib/gtestutils.c | 3 ++- glib/tests/testing.c | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8ed76c..061c67b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-23 Jens Granseuer + + * glib/gtestutils.c: (g_test_trap_fork): + * glib/tests/testing.c: (test_assertions): Only declare variables at + the beginning of a code block. Bug #511654. + 2008-01-21 Matthias Clasen * configure.in: Bump version diff --git a/glib/gtestutils.c b/glib/gtestutils.c index bdf3642..dc2d0c9 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -1457,6 +1457,7 @@ g_test_trap_fork (guint64 usec_timeout, { fd_set fds; struct timeval tv; + int ret; FD_ZERO (&fds); if (stdout_pipe[0] >= 0) FD_SET (stdout_pipe[0], &fds); @@ -1466,7 +1467,7 @@ g_test_trap_fork (guint64 usec_timeout, FD_SET (stdtst_pipe[0], &fds); tv.tv_sec = 0; tv.tv_usec = MIN (usec_timeout ? usec_timeout : 1000000, 100 * 1000); /* sleep at most 0.5 seconds to catch clock skews, etc. */ - int ret = select (MAX (MAX (stdout_pipe[0], stderr_pipe[0]), stdtst_pipe[0]) + 1, &fds, NULL, NULL, &tv); + ret = select (MAX (MAX (stdout_pipe[0], stderr_pipe[0]), stdtst_pipe[0]) + 1, &fds, NULL, NULL, &tv); if (ret < 0 && errno != EINTR) { g_warning ("Unexpected error in select() while reading from child process (%d): %s", test_trap_last_pid, g_strerror (errno)); diff --git a/glib/tests/testing.c b/glib/tests/testing.c index 8b88a37..d43dc55 100644 --- a/glib/tests/testing.c +++ b/glib/tests/testing.c @@ -26,13 +26,14 @@ static void test_assertions (void) { + gchar *fuu; g_assert_cmpint (1, >, 0); g_assert_cmphex (2, ==, 2); g_assert_cmpfloat (3.3, !=, 7); g_assert_cmpfloat (7, <=, 3 + 4); g_assert (TRUE); g_assert_cmpstr ("foo", !=, "faa"); - gchar *fuu = g_strdup_printf ("f%s", "uu"); + fuu = g_strdup_printf ("f%s", "uu"); g_test_queue_free (fuu); g_assert_cmpstr ("foo", !=, fuu); g_assert_cmpstr ("fuu", ==, fuu); -- 2.7.4