antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright/gtkshell callbacks.c gtkshell.c main....


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright/gtkshell callbacks.c gtkshell.c main....
Date: Wed, 21 Feb 2007 21:39:50 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/02/21 21:39:50

Modified files:
        gtkshell       : callbacks.c gtkshell.c main.c text.c updated.c 
                         updated_label.c 

Log message:
        Fixed updater list initialization, fixing a crash on linux.  
        Fixed assignment warning in text.c.  Fixed inappropriate calls of
        UNUSED.  Added more extensive assertions and debugging messages to
        the updater code.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/callbacks.c?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.c?cvsroot=antiright&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/main.c?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated.c?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated_label.c?cvsroot=antiright&r1=1.9&r2=1.10

Patches:
Index: callbacks.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/callbacks.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- callbacks.c 21 Feb 2007 19:44:50 -0000      1.7
+++ callbacks.c 21 Feb 2007 21:39:50 -0000      1.8
@@ -22,7 +22,6 @@
 
 #include "gtkshell.h"
 
-#define DEBUG
 
 void
 gsh_test_exit (struct GSH * gsh)
@@ -30,10 +29,14 @@
 #ifdef DEBUG
   ARBUG("gsh_test_exit()");
 #endif /* DEBUG */
-  assert(gsh);
+
+  g_assert(gsh);
   if (gsh->flags.button_exits)
     exit (0);
-  ARBUG("made it");
+
+#ifdef DEBUG
+  ARBUG("==>made it past exit");
+#endif /* DEBUG */
 }
 
 void
@@ -48,6 +51,8 @@
 
   UNUSED (widget);
 
+  g_assert(cb);
+
   antiright_system (cb->data);
   gsh_test_exit (cb->gsh);
 }
@@ -60,8 +65,12 @@
 
   cb = (struct GSH_CBData *) data;
 
+  g_assert(widget);
+
   input = gtk_entry_get_text (GTK_ENTRY (widget));
 
+  g_assert(cb);
+
   if (cb->gsh->flags.prompt_echoes)
     g_print ("%s\n", input);
   else

Index: gtkshell.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- gtkshell.c  21 Feb 2007 16:15:49 -0000      1.11
+++ gtkshell.c  21 Feb 2007 21:39:50 -0000      1.12
@@ -48,13 +48,14 @@
 void
 gsh_GSH_Rows (struct GSH_Rows * rows)
 {
-  /* rows->row is initialized by gsh_manage.  */
+  rows->row = 0;
   rows->rows = 8;
 }
 void
 gsh_GSH_Updater (struct GSH_Updater * update)
 {
   update->period = 1000;
+  update->list = NULL;
 }
 void
 gsh_GSH (struct GSH * gsh)

Index: main.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/main.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- main.c      21 Feb 2007 19:44:50 -0000      1.7
+++ main.c      21 Feb 2007 21:39:50 -0000      1.8
@@ -29,6 +29,11 @@
 
   gsh_stack_init (&gsh, &argc, &argv);
 
+#ifdef DEBUG
+  g_debug("rows:\t%d\n", gsh.rows.rows);
+  g_debug("row:\t%d\n", gsh.rows.row);
+#endif /* DEBUG */
+
   gsh.flags.dont_scroll =
     (((argc > 1)
       && (strlen (argv[1]) == 3))

Index: text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- text.c      20 Feb 2007 04:29:43 -0000      1.7
+++ text.c      21 Feb 2007 21:39:50 -0000      1.8
@@ -73,7 +73,7 @@
 
 
   file = fopen (filename, "r");
-  while (read = fread (buf, sizeof (char), BUFSIZ, file))
+  while ((read = fread (buf, sizeof (char), BUFSIZ, file)))
   {
     gtk_text_buffer_get_end_iter (buffer, &iter);
     gtk_text_buffer_insert (buffer, &iter, buf, read);

Index: updated.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- updated.c   20 Feb 2007 04:29:43 -0000      1.5
+++ updated.c   21 Feb 2007 21:39:50 -0000      1.6
@@ -31,7 +31,19 @@
   ARBUG ("gsh_append_updater()");
 #endif                         /* DEBUG */
 
+  g_assert(gsh);
+  /* g_assert(gsh->update.list); */
+  g_assert(item);
+
+#ifdef DEBUG
+  ARBUG("assertions passed");
+#endif /* DEBUG */
+
   gsh->update.list = g_slist_append (gsh->update.list, item);
+
+#ifdef DEBUG
+  ARBUG ("end gsh_append_updater()");
+#endif /* DEBUG */
 }
 
 void
@@ -93,9 +105,10 @@
   ARBUG ("gsh_perform_updates()");
 #endif                         /* DEBUG */
 
+  g_assert(data);
+
   gsh = (struct GSH *) data;
 
-  UNUSED (data);               /* DATA is unused.  */
 
 #ifdef DEBUG
   g_assert (gsh->update.list);

Index: updated_label.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated_label.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- updated_label.c     20 Feb 2007 04:29:43 -0000      1.9
+++ updated_label.c     21 Feb 2007 21:39:50 -0000      1.10
@@ -28,6 +28,7 @@
   /* This ensures that the result string is not empty, avoiding certain
      formatting problems.  */
   /* Otherwise, a GTK warning is produced.  */
+  g_assert(*results);
   if (!strncmp (*results, "", 1))
   {
     free (*results);
@@ -42,10 +43,10 @@
 
 #ifdef DEBUG
   ARBUG ("gsh_update_label()");
+#endif /* DEBUG */
 
   g_assert (command);
   g_assert (widget);
-#endif                         /* DEBUG */
 
   results = antiright_pipe_read (command);
   gsh_check_results (&results);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]