From 6bbef67ad629b5027125dd5f2e61296e3d7679af Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 31 Mar 2008 04:22:55 +0000 Subject: [PATCH] =?utf8?q?Don't=20use=20ARG=5FMAX.=20(#522335,=20patch=20b?= =?utf8?q?y=20Sebastian=20Dr=C3=B6ge)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2008-03-30 Matthias Clasen * glib/gtester.c: Don't use ARG_MAX. (#522335, patch by Sebastian Dröge) svn path=/trunk/; revision=6782 --- ChangeLog | 5 +++++ glib/gtester.c | 32 +++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 92bfde8..e81e33d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-03-30 Matthias Clasen + * glib/gtester.c: Don't use ARG_MAX. (#522335, patch by + Sebastian Dröge) + +2008-03-30 Matthias Clasen + * glib/gmacros.h: Add macros wrapping the gcc alloc_size function attribute. (#523019, Rodrigo Moya) diff --git a/glib/gtester.c b/glib/gtester.c index 8fae5a1..03549d9 100644 --- a/glib/gtester.c +++ b/glib/gtester.c @@ -273,7 +273,8 @@ launch_test_binary (const char *binary, GTestLogBuffer *tlb; GSList *slist, *free_list = NULL; GError *error = NULL; - const gchar *argv[ARG_MAX]; + int argc = 0; + const gchar **argv; GPid pid = 0; gint report_pipe[2] = { -1, -1 }; guint child_report_cb_id = 0; @@ -289,7 +290,34 @@ launch_test_binary (const char *binary, return FALSE; } + /* setup argc */ + for (slist = subtest_args; slist; slist = slist->next) + argc++; + /* argc++; */ + if (subtest_quiet) + argc++; + if (subtest_verbose) + argc++; + if (!subtest_mode_fatal) + argc++; + if (subtest_mode_quick) + argc++; + else + argc++; + if (subtest_mode_perf) + argc++; + if (gtester_list_tests) + argc++; + if (subtest_seedstr) + argc++; + argc++; + if (skip_tests) + argc++; + for (slist = subtest_paths; slist; slist = slist->next) + argc++; + /* setup argv */ + argv = g_malloc ((argc + 1) * sizeof(gchar *)); argv[i++] = binary; for (slist = subtest_args; slist; slist = slist->next) argv[i++] = (gchar*) slist->data; @@ -343,8 +371,10 @@ launch_test_binary (const char *binary, else g_warning ("Failed to execute test binary: %s: %s", argv[0], error->message); g_clear_error (&error); + g_free (argv); return FALSE; } + g_free (argv); subtest_running = TRUE; subtest_io_pending = TRUE; -- 2.7.4