glib r6782 - in trunk: . glib



Author: matthiasc
Date: Mon Mar 31 05:22:55 2008
New Revision: 6782
URL: http://svn.gnome.org/viewvc/glib?rev=6782&view=rev

Log:
2008-03-30  Matthias Clasen  <mclasen redhat com>

        * glib/gtester.c: Don't use ARG_MAX.  (#522335, patch by
        Sebastian DrÃge)




Modified:
   trunk/ChangeLog
   trunk/glib/gtester.c

Modified: trunk/glib/gtester.c
==============================================================================
--- trunk/glib/gtester.c	(original)
+++ trunk/glib/gtester.c	Mon Mar 31 05:22:55 2008
@@ -273,7 +273,8 @@
   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 @@
       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 @@
       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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]