Revert the g_set_prgname change
authorMatthias Clasen <mclasen@redhat.com>
Mon, 21 Dec 2009 14:11:23 +0000 (09:11 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 21 Dec 2009 14:16:32 +0000 (09:16 -0500)
This change breaks our API and causes warnings from essentially all applications.
See bug 563627.

glib/gutils.c
glib/tests/option-context.c

index b5e9c19..744663e 100644 (file)
@@ -1968,17 +1968,10 @@ g_get_prgname (void)
 void
 g_set_prgname (const gchar *prgname)
 {
-  gboolean already_set = FALSE;
-
   G_LOCK (g_prgname);
-  if (g_prgname)
-    already_set = TRUE;
-  else
-    g_prgname = g_strdup (prgname);
+  g_free (g_prgname);
+  g_prgname = g_strdup (prgname);
   G_UNLOCK (g_prgname);
-
-  if (already_set)
-    g_warning ("g_set_prgname() called multiple times");
 }
 
 G_LOCK_DEFINE_STATIC (g_application_name);
index 14fd9d9..8b6292a 100644 (file)
@@ -1770,13 +1770,11 @@ main (int   argc,
   g_test_add_func ("/context/add", add_test1);
 
   /* Test parsing empty args */
-#if 0
   /* This test relies on the ability to call g_set_prgname() more
    * than once (without incurring a g_warning), which is no longer
    * the case.
    */
   g_test_add_func ("/context/empty1", empty_test1);
-#endif
   g_test_add_func ("/context/empty2", empty_test2);
   g_test_add_func ("/context/empty3", empty_test3);