obconf gcc 2.95 compatibility

Corey Wright undefined at pobox.com
Mon Oct 13 03:54:49 EDT 2003


while compiling obconf for debian woody, which only includes gcc 2.95, i
found that one of the files takes advantage of c99 (i believe),
something 2.95 doesn't allow.

this may even be glade autogenerate code as i've seen this before in
another recent package i've compiled with 2.95.

the fix is simple: make sure all local variables are declared before any
operations or function calls.  some people still do this out of habit,
some consider it good style even with c++ which allows this.

thanks for considering us debian (stable) laggers. ;-)
-- 
undefined at pobox.com
-------------- next part --------------
--- obconf-1.5/src/handlers.c~	Sun Sep 28 09:10:25 2003
+++ obconf-1.5/src/handlers.c	Sun Oct  5 05:46:15 2003
@@ -44,13 +44,16 @@
   GtkWidget *winresist  = glade_xml_get_widget(glade, "resist_window");
   GtkWidget *edgeresist = glade_xml_get_widget(glade, "resist_edge");
   GtkSizeGroup *group1  = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+  GtkWidget *winresist_l;
+  GtkWidget *edgeresist_l;
+  GtkSizeGroup *group2;
 
   gtk_size_group_add_widget(group1, winresist);
   gtk_size_group_add_widget(group1, edgeresist);
 
-  GtkWidget *winresist_l  = glade_xml_get_widget(glade, "resist_window_label");
-  GtkWidget *edgeresist_l = glade_xml_get_widget(glade, "resist_edge_label");
-  GtkSizeGroup *group2    = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+  winresist_l  = glade_xml_get_widget(glade, "resist_window_label");
+  edgeresist_l = glade_xml_get_widget(glade, "resist_edge_label");
+  group2    = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
   gtk_size_group_add_widget(group2, winresist_l);
   gtk_size_group_add_widget(group2, edgeresist_l);
@@ -61,13 +64,16 @@
     GtkWidget *posi = glade_xml_get_widget(glade, "dock_position");
     GtkWidget *dir  = glade_xml_get_widget(glade, "dock_direction");
     GtkSizeGroup *group1 = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+    GtkWidget *posi_l;
+    GtkWidget *dir_l;
+    GtkSizeGroup *group2;
 
     gtk_size_group_add_widget(group1, posi);
     gtk_size_group_add_widget(group1, dir);
 
-    GtkWidget *posi_l = glade_xml_get_widget(glade, "dock_position_label");
-    GtkWidget *dir_l  = glade_xml_get_widget(glade, "dock_direction_label");
-    GtkSizeGroup *group2 = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+    posi_l = glade_xml_get_widget(glade, "dock_position_label");
+    dir_l  = glade_xml_get_widget(glade, "dock_direction_label");
+    group2 = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
     gtk_size_group_add_widget(group2, posi_l);
     gtk_size_group_add_widget(group2, dir_l);
@@ -979,14 +985,16 @@
                                          const gchar *new_text,
                                          gpointer data)
 {
-    if (mapping) return;
-
-    GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
+    GtkTreePath *path;
     GtkTreeIter it;
     gchar *old_text;
     GList *lit;
     gint i;
     xmlNodePtr n, c;
+
+    if (mapping) return;
+
+    path = gtk_tree_path_new_from_string (path_string);
 
     gtk_tree_model_get_iter(GTK_TREE_MODEL(desktop_store), &it, path);
 


More information about the openbox mailing list