antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright gtkshell/add_options.c gtkshell/argum...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright gtkshell/add_options.c gtkshell/argum...
Date: Fri, 23 Feb 2007 03:11:52 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/02/23 03:11:52

Modified files:
        gtkshell       : add_options.c arguments.c button.c callbacks.c 
                         containers.c dialog_options.c geometry.c 
                         gtkshell.c gtkshell.h main.c options.c row.c 
                         text.c updated.c updated.h updated_label.c 
                         updated_label.h updated_options.c 
                         updated_progress.c updated_progress.h 
        libantiright   : library.h 

Log message:
        Use libantiright assertion macros.  Declare functions static where
        appropriate.  Change command assignment in callback structure of
        command button to reference.  Added libantiright conditional macros.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/add_options.c?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/arguments.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/button.c?cvsroot=antiright&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/callbacks.c?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/containers.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/dialog_options.c?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/geometry.c?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.c?cvsroot=antiright&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.h?cvsroot=antiright&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/main.c?cvsroot=antiright&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/options.c?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/row.c?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated.c?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated.h?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated_label.c?cvsroot=antiright&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated_label.h?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated_options.c?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated_progress.c?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated_progress.h?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/library.h?cvsroot=antiright&r1=1.7&r2=1.8

Patches:
Index: gtkshell/add_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/add_options.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gtkshell/add_options.c      20 Feb 2007 03:59:50 -0000      1.5
+++ gtkshell/add_options.c      23 Feb 2007 03:11:51 -0000      1.6
@@ -22,7 +22,7 @@
 
 #include "gtkshell.h"
 
-void
+static void
 gsh_handle_add_image_button (
                      struct GSH * gsh, int argc, char **argv, int *counter)
 {
@@ -31,7 +31,7 @@
                    argv[(*counter) + 1]);
   gsh_count (argc, counter);
 }
-void
+static void
 gsh_handle_add_unlabeled_image_button (
                      struct GSH * gsh, int argc, char **argv, int *counter)
 {

Index: gtkshell/arguments.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/arguments.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gtkshell/arguments.c        20 Feb 2007 04:29:43 -0000      1.4
+++ gtkshell/arguments.c        23 Feb 2007 03:11:52 -0000      1.5
@@ -28,14 +28,8 @@
   int counter;
 
   for (counter = 1; counter < argc; counter++)
-  {
     if (argv[counter][0] == '-')
-    {
       gsh_handle_switch_arguments (gsh, argc, argv, &counter);
-    }
     else
-    {
       gsh_command_button (gsh, argv[counter]);
-    }
-  }
 }

Index: gtkshell/button.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/button.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- gtkshell/button.c   22 Feb 2007 23:16:45 -0000      1.10
+++ gtkshell/button.c   23 Feb 2007 03:11:52 -0000      1.11
@@ -39,10 +39,11 @@
        ARPASSERT(gsh);
   cb->gsh = gsh;
 
-  asprintf ((char **) &cb->data, "%s", command);
+       cb->data=command; /* command from argv, literal, or preallocated.  */
+
   label_text = antiright_beautified_label (command);
   gsh->button = gtk_button_new_with_label (label_text);
-  free (label_text);
+  g_free (label_text);
 
        /address@hidden@*/
   (void)g_signal_connect (G_OBJECT (gsh->button), "clicked",

Index: gtkshell/callbacks.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/callbacks.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- gtkshell/callbacks.c        22 Feb 2007 22:13:02 -0000      1.9
+++ gtkshell/callbacks.c        23 Feb 2007 03:11:52 -0000      1.10
@@ -23,7 +23,7 @@
 #include "gtkshell.h"
 
 
-void
+static void
 gsh_test_exit (struct GSH * gsh)
 {
 #ifdef DEBUG
@@ -72,24 +72,21 @@
 
   cb = (struct GSH_CBData *) data;
 
-       if(widget != NULL)
+       ARWIFNP(widget)
                {
                input = gtk_entry_get_text (GTK_ENTRY (widget));
 
-                       if(cb != NULL)
+                       ARWIFNP(cb)
                                {
-                                       if (cb->gsh->flags.prompt_echoes == 
TRUE)
+                                       ARIFB(cb->gsh->flags.prompt_echoes)
                                g_print ("%s\n", input);
                                else
                                sysprintf ("%s %s", (char *) cb->data, (char *) 
input);
 
                                        gsh_test_exit(cb->gsh);
                                }
-                       else
-                               ARWARN("callback data is NULL, no action 
taken");
 
                        gtk_entry_set_text (GTK_ENTRY (widget), "");    /* 
Clear.  */
                }
-       else
-               ARWARN("widget is NULL, no action taken");
 }
+

Index: gtkshell/containers.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/containers.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gtkshell/containers.c       20 Feb 2007 04:29:43 -0000      1.4
+++ gtkshell/containers.c       23 Feb 2007 03:11:52 -0000      1.5
@@ -57,7 +57,5 @@
   }
 
   gtk_widget_show (gsh->rows.h);
-  gsh->rows.v = gtk_vbox_new (FALSE, 2);
-  gtk_container_add (GTK_CONTAINER (gsh->rows.h), gsh->rows.v);
-  gtk_widget_show (gsh->rows.v);
+       gsh_new_row (gsh);
 }

Index: gtkshell/dialog_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/dialog_options.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- gtkshell/dialog_options.c   22 Feb 2007 22:13:02 -0000      1.7
+++ gtkshell/dialog_options.c   23 Feb 2007 03:11:52 -0000      1.8
@@ -22,7 +22,7 @@
 
 #include "gtkshell.h"
 
-void
+static void
 gsh_message_dialog (struct GSH * gsh, GtkMessageType type, char *text)
 {
   GtkWidget *dialog;
@@ -35,7 +35,8 @@
   gtk_dialog_run (GTK_DIALOG (dialog));
   exit (0);
 }
-void
+
+static void
 gsh_setup_message_dialog (struct GSH * gsh, int argc, char **argv,
                          unsigned int *counter, GtkMessageType type)
 {
@@ -43,7 +44,7 @@
   gsh_message_dialog (gsh, type, argv[(*counter)]);
 }
 
-void
+static void
 gsh_font_dialog ()
 {
   GtkWidget *dialog;
@@ -60,11 +61,11 @@
 
   exit (0);
 }
-#define ARNOP(x)
-void
+
+static void
 gsh_color_dialog ()
 {
-  GtkWidget *dialog;
+  const GtkWidget *dialog;
 
   dialog = gtk_color_selection_dialog_new ("Color Selector");
 
@@ -85,10 +86,10 @@
   exit (0);
 }
 
-void
+static void
 gsh_about_dialog ()
 {
-  GtkWidget *dialog;
+  const GtkWidget *dialog;
   const gchar *authors[] =
   {"Jeffrey E. Bedard <address@hidden>",
   NULL};
@@ -123,7 +124,9 @@
 gsh_handle_dialog_arguments (struct GSH * gsh, int argc, char **argv,
                             int *counter)
 {
-  assert (strlen (argv[(*counter)]) > 2);
+  g_assert (strlen (argv[(*counter)]) > 2);
+       ARPASSERT(gsh);
+
   switch (argv[(*counter)][2])
   {
   case 'a':

Index: gtkshell/geometry.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/geometry.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- gtkshell/geometry.c 20 Feb 2007 04:29:43 -0000      1.7
+++ gtkshell/geometry.c 23 Feb 2007 03:11:52 -0000      1.8
@@ -22,7 +22,7 @@
 
 #include "gtkshell.h"
 
-
+/* gsh->geometry is freed after this, so only call once.  */
 void
 gsh_set_geometry (struct GSH * gsh)
 {
@@ -34,7 +34,7 @@
   }
 }
 
-gboolean
+static gboolean
 gsh_check_geometry (struct GSH * gsh)
 {
   gboolean geometry_status = FALSE;

Index: gtkshell/gtkshell.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- gtkshell/gtkshell.c 22 Feb 2007 22:13:02 -0000      1.13
+++ gtkshell/gtkshell.c 23 Feb 2007 03:11:52 -0000      1.14
@@ -38,7 +38,7 @@
 
   return (window);
 }
-void
+static void
 gsh_GSH_Flags (struct GSH_Flags * flags)
 {
   flags->dont_scroll = FALSE;
@@ -47,13 +47,13 @@
   flags->prompt_echoes = FALSE;
   flags->horizontal_labels = FALSE;
 }
-void
+static void
 gsh_GSH_Rows (struct GSH_Rows * rows)
 {
   rows->row = 0;
   rows->rows = 8;
 }
-void
+static void
 gsh_GSH_Updater (struct GSH_Updater * update)
 {
   update->period = 1000;

Index: gtkshell/gtkshell.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- gtkshell/gtkshell.h 22 Feb 2007 22:13:02 -0000      1.14
+++ gtkshell/gtkshell.h 23 Feb 2007 03:11:52 -0000      1.15
@@ -88,4 +88,5 @@
 
 GtkWidget *
   gsh_create_main_window ();
+
 #endif

Index: gtkshell/main.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/main.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- gtkshell/main.c     21 Feb 2007 21:39:50 -0000      1.8
+++ gtkshell/main.c     23 Feb 2007 03:11:52 -0000      1.9
@@ -49,5 +49,5 @@
 
   gtk_main ();
 
-  return (0);
+  return (EXIT_SUCCESS);
 }

Index: gtkshell/options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/options.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gtkshell/options.c  22 Feb 2007 22:13:02 -0000      1.6
+++ gtkshell/options.c  23 Feb 2007 03:11:52 -0000      1.7
@@ -22,18 +22,21 @@
 
 #include "gtkshell.h"
 
+#ifdef _GNU_SOURCE
+inline
+#endif /* _GNU_SOURCE */
 void
 gsh_count (int argc, int *counter)
 {
   (*counter)++;
-  assert ((*counter) <= argc);
+  g_assert ((*counter) <= argc);
 }
 
 void
 gsh_handle_switch_arguments (struct GSH * gsh, int argc, char **argv, int 
*counter)
 {
   gsh_check_row (gsh);
-  switch (argv[(*counter)][1])
+  switch (argv[*counter][1])
   {
   case 'a':
     gsh_handle_add_arguments (gsh,

Index: gtkshell/row.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/row.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- gtkshell/row.c      20 Feb 2007 04:29:43 -0000      1.9
+++ gtkshell/row.c      23 Feb 2007 03:11:52 -0000      1.10
@@ -22,7 +22,7 @@
 
 #include "gtkshell.h"
 
-void
+static void
 gsh_manage_generic (struct GSH * gsh, GtkWidget * widget)
 {
 
@@ -63,9 +63,6 @@
     gsh_manage (gsh, widget);
 }
 
-
-
-
 void
 gsh_new_row (struct GSH * gsh)
 {

Index: gtkshell/text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- gtkshell/text.c     22 Feb 2007 23:16:45 -0000      1.9
+++ gtkshell/text.c     23 Feb 2007 03:11:52 -0000      1.10
@@ -33,7 +33,7 @@
   /* Set up callback data.  */
   cb = (struct GSH_CBData *) xmalloc (sizeof (struct GSH_CBData));
   cb->gsh = gsh;
-       if(command != NULL)
+       ARIFP(command)
          asprintf ((char **) &cb->data, "%s", command);
        else
                asprintf ((char **) &cb->data, "echo");
@@ -82,16 +82,19 @@
 
   file = fopen (filename, "r");
 
-       ARPASSERT(file);
-
-  while ((read = fread (buf, sizeof (char), BUFSIZ, file)))
+       ARWIFNP(file)
+               {
+               while ((read = fread (buf, sizeof (char), BUFSIZ, file)) != 0)
   {
+                                       /address@hidden/
     gtk_text_buffer_get_end_iter (buffer, &iter);
-    gtk_text_buffer_insert (buffer, &iter, buf, read);
+                       gtk_text_buffer_insert (buffer, &iter, buf, (gint)read);
+                       }
+
+                       (void)fclose (file);
   }
-  fclose (file);
 
-  if (gsh->geometry == NULL)
+  ARIFNP(gsh->geometry)
     asprintf (&gsh->geometry, "775x700");
 
        gsh_widget_set_font_mono(text);

Index: gtkshell/updated.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- gtkshell/updated.c  22 Feb 2007 22:13:02 -0000      1.7
+++ gtkshell/updated.c  23 Feb 2007 03:11:52 -0000      1.8
@@ -23,7 +23,7 @@
 #include "gtkshell.h"
 
 
-void
+static void
 gsh_append_updater (struct GSH * gsh, gsh_updater_data * item)
 {
 
@@ -39,7 +39,7 @@
 #endif /* DEBUG */
 }
 
-void
+static void
 gsh_assign_updater (
                    gsh_updater_data * item,
                    void (*function) (gchar *, gpointer),
@@ -71,7 +71,7 @@
   gsh_append_updater (gsh, item);
 }
 
-void 
+static void 
 gsh_update_each (gpointer data, gpointer user_data)
 {
   gsh_updater_data *item;
@@ -81,7 +81,7 @@
 
   /* Ensure that the argument containing the structure is not empty.  */
 
-       if(data != NULL)
+       ARIFP(data)
                {
                /* Assign data to structure and call 
                         * function pointer with parameters.  */
@@ -94,7 +94,7 @@
                }
 }
 
-gint
+static gint
 gsh_perform_updates (gpointer data)
 {
   struct GSH *gsh;

Index: gtkshell/updated.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gtkshell/updated.h  22 Feb 2007 22:13:02 -0000      1.4
+++ gtkshell/updated.h  23 Feb 2007 03:11:52 -0000      1.5
@@ -35,6 +35,6 @@
                 void (*function) (char *, gpointer),
                 gchar *command, GtkWidget *widget);
 
-  void
+void
     gsh_start_updates (struct GSH * gsh);
 #endif

Index: gtkshell/updated_label.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated_label.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- gtkshell/updated_label.c    21 Feb 2007 21:39:50 -0000      1.10
+++ gtkshell/updated_label.c    23 Feb 2007 03:11:52 -0000      1.11
@@ -22,21 +22,22 @@
 
 #include "gtkshell.h"
 
-void
+static void
 gsh_check_results (char **results)
 {
   /* 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))
+  /* Otherwise, a GTK warning and termination occurs.  */
+       ARPASSERT(*results);
+
+  if (*results[0] == '\0')
   {
     free (*results);
-    asprintf (results, " ");
+    asprintf (results, "(empty)");
   }
 }
 
-void
+static void
 gsh_update_label (char *command, gpointer widget)
 {
   char *results;
@@ -45,8 +46,8 @@
   ARBUG ("gsh_update_label()");
 #endif /* DEBUG */
 
-  g_assert (command);
-  g_assert (widget);
+       ARPASSERT(command);
+       ARPASSERT(widget);
 
   results = antiright_pipe_read (command);
   gsh_check_results (&results);
@@ -63,6 +64,9 @@
   g_message ("gsh_add_updated_label()");
 #endif                         /* DEBUG */
 
-  widget = gsh_add_label (gsh, NULL);
+       ARPASSERT(gsh);
+       ARPASSERT(command);
+
+  widget = gsh_add_label (gsh, command);
   gsh_add_updater (gsh, &gsh_update_label, command, (gpointer) widget);
 }

Index: gtkshell/updated_label.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated_label.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gtkshell/updated_label.h    20 Feb 2007 04:29:43 -0000      1.3
+++ gtkshell/updated_label.h    23 Feb 2007 03:11:52 -0000      1.4
@@ -1,6 +1,6 @@
 /*
   AntiRight
-  (c) 2002-2006 Jeffrey Bedard
+  (c) 2002-2007 Jeffrey Bedard
   address@hidden
 
   This file is part of AntiRight.
@@ -24,8 +24,7 @@
 #define GSH_UPDATED_LABEL_H
 
 void
-  gsh_update_label (char *command, void *widget);
-
-void
   gsh_add_updated_label (struct GSH * gsh, char *command);
-#endif
+
+#endif /* GSH_UPDATED_LABEL_H */
+

Index: gtkshell/updated_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated_options.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gtkshell/updated_options.c  20 Feb 2007 04:29:43 -0000      1.6
+++ gtkshell/updated_options.c  23 Feb 2007 03:11:52 -0000      1.7
@@ -22,18 +22,20 @@
 
 #include "gtkshell.h"
 
-void
+static void
 gsh_test_updating (struct GSH * gsh)
 {
-  if (!gsh->flags.updating)
+       ARPASSERT(gsh);
+
+  ARIFNB(gsh->flags.updating)
   {
     gsh_start_updates (gsh);
     gsh->flags.updating = TRUE;
   }
 }
 
-void
-gsh_updater_argument_generic (struct GSH * gsh, int argc, unsigned int 
*counter)
+static void
+gsh_updater_argument_generic (struct GSH * gsh, int argc, int *counter)
 {
   gsh_count (argc, counter);
   gsh_test_updating (gsh);
@@ -43,7 +45,7 @@
 gsh_handle_updated_arguments (struct GSH * gsh, int argc,
                              char **argv, int *counter)
 {
-  assert (strlen (argv[(*counter)]) > 2);
+  g_assert (strlen (argv[(*counter)]) > 2);
   switch (argv[(*counter)][3])
   {
   case 'l':

Index: gtkshell/updated_progress.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated_progress.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gtkshell/updated_progress.c 20 Feb 2007 04:29:43 -0000      1.5
+++ gtkshell/updated_progress.c 23 Feb 2007 03:11:52 -0000      1.6
@@ -1,6 +1,6 @@
 /*
   AntiRight
-  (c) 2002-2006 Jeffrey Bedard
+  (c) 2002-2007 Jeffrey Bedard
   address@hidden
 
   This file is part of AntiRight.
@@ -22,21 +22,30 @@
 
 #include "gtkshell.h"
 
-void
-gsh_update_progress (char *command, void *widget)
+static void
+gsh_update_progress (gchar *command, gpointer widget)
 {
-  char *results;
+  gchar *results;
+
+       ARPASSERT(command);
+       ARPASSERT(widget);
+
   results = antiright_pipe_read (command);
+       ARPASSERT(results);
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR ((GtkWidget *) widget),
                                 strtod (results, NULL));
   free (results);
 }
 void
-gsh_add_updated_progress (struct GSH * gsh, char *command)
+gsh_add_updated_progress (struct GSH * gsh, gchar *command)
 {
   GtkWidget *widget;
+
+       ARPASSERT(gsh);
+       ARPASSERT(command);
+
   widget = gtk_progress_bar_new ();
   gsh_manage_unexpanded (gsh, widget);
   gsh_add_updater (gsh, &gsh_update_progress,
-                  command, (void *) widget);
+                  command, widget);
 }

Index: gtkshell/updated_progress.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated_progress.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gtkshell/updated_progress.h 20 Feb 2007 04:29:43 -0000      1.3
+++ gtkshell/updated_progress.h 23 Feb 2007 03:11:52 -0000      1.4
@@ -24,8 +24,6 @@
 #define GSH_UPDATED_PROGRESS_H
 
 void
-  gsh_update_progress (char *command, void *widget);
+  gsh_add_updated_progress (struct GSH * gsh, gchar *command);
 
-void
-  gsh_add_updated_progress (struct GSH * gsh, char *command);
 #endif

Index: libantiright/library.h
===================================================================
RCS file: /sources/antiright/antiright/libantiright/library.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- libantiright/library.h      22 Feb 2007 23:20:07 -0000      1.7
+++ libantiright/library.h      23 Feb 2007 03:11:52 -0000      1.8
@@ -35,10 +35,44 @@
 #include "system.h"
 #include "util.h"
 
-#define ARBUGPARAM(message) "%s:%d: %s", __FILE__, __LINE__, message
-#define ARBUG(message) g_debug(ARBUGPARAM(message))
-#define ARWARN(message) g_warning(ARBUGPARAM(message))
-#define ARERR(message) g_error(ARBUGPARAM(message))
-#define ARBASSERT(x) g_assert(x == TRUE)
-#define ARPASSERT(x) g_assert(x != NULL)
+#define ARBUGPARAM(message) \
+       "%s:%d: %s", __FILE__, __LINE__, message
+
+#define ARBUG(message) \
+       g_debug(ARBUGPARAM(message))
+
+#define ARWARN(message) \
+       g_warning(ARBUGPARAM(message))
+
+#define ARERR(message) \
+       g_error(ARBUGPARAM(message))
+
+#define ARBBOOL(x) x == TRUE
+#define ARPBOOL(x) x != NULL
+
+#define ARASSERT g_assert
+
+#define ARBASSERT(x) \
+       ARASSERT(ARBBOOL(x))
+
+#define ARPASSERT(x) \
+       ARASSERT(ARPBOOL(x))
+
+#define ARIFB(x) \
+       if(ARBBOOL(x))
+
+#define ARIFNB(x) \
+       if(!(ARBBOOL(x)))
+
+#define ARIFP(x) \
+       if(ARPBOOL(x))
+
+#define ARIFNP(x) \
+       if(!(ARPBOOL(x)))
+
+#define ARWIFNP(x) \
+       ARIFNP(x) \
+               ARWARN("NULL data passed, operation not performed"); \
+       else
+
 #endif                         /* LIBAR_LIBRARY_H */




reply via email to

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