commit-gnue
[Top][All Lists]
Advanced

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

gnue/geas/src/methods methods.c methods_glibmod...


From: Daniel E. Baumann
Subject: gnue/geas/src/methods methods.c methods_glibmod...
Date: Fri, 08 Jun 2001 15:47:46 -0700

CVSROOT:        /cvs
Module name:    gnue
Changes by:     Daniel E. Baumann <address@hidden>      01/06/08 15:47:46

Modified files:
        geas/src/methods: methods.c methods_glibmodule.h methods_oaf.h 
                          methods_unstable.h 

Log message:
        Cleaned up code added assertions and if_fail checks.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/methods/methods.c.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/methods/methods_glibmodule.h.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/methods/methods_oaf.h.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/methods/methods_unstable.h.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gnue/geas/src/methods/methods.c
diff -u gnue/geas/src/methods/methods.c:1.9 gnue/geas/src/methods/methods.c:1.10
--- gnue/geas/src/methods/methods.c:1.9 Fri Jun  8 14:26:45 2001
+++ gnue/geas/src/methods/methods.c     Fri Jun  8 15:47:46 2001
@@ -19,7 +19,7 @@
   along with GEAS; if not, write to the Free Software Foundation, Inc.,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-  $Id: methods.c,v 1.9 2001/06/08 21:26:45 baumannd Exp $
+  $Id: methods.c,v 1.10 2001/06/08 22:47:46 baumannd Exp $
 */
 
 #include "config.h"
@@ -73,18 +73,21 @@
   /* this doesn't really do much exciting stuff */
   criticalerror ("No method code handling has been compiled.");
   message ("No business class methods will work.");
+  return (FALSE);
 }
 
 gboolean
 load_method_handlers (configuration config)
 {
   /* can't load if we're not ready, and we can't be ready (see above :) */
+  return (FALSE);
 }
 
 gboolean
 shutdown_method_handling (void)
 {
   /* no code here */
+  return (FALSE);
 }
 
 /* assumes everything has been validated already */
@@ -95,6 +98,7 @@
 {
   /* hi, mom! */
   fatal_error ("No method code handling has been compiled.");
+  return (NULL);
 }
 
 #endif
Index: gnue/geas/src/methods/methods_glibmodule.h
diff -u gnue/geas/src/methods/methods_glibmodule.h:1.9 
gnue/geas/src/methods/methods_glibmodule.h:1.10
--- gnue/geas/src/methods/methods_glibmodule.h:1.9      Fri Jun  8 14:26:45 2001
+++ gnue/geas/src/methods/methods_glibmodule.h  Fri Jun  8 15:47:46 2001
@@ -19,7 +19,7 @@
   along with GEAS; if not, write to the Free Software Foundation, Inc.,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-  $Id: methods_glibmodule.h,v 1.9 2001/06/08 21:26:45 baumannd Exp $
+  $Id: methods_glibmodule.h,v 1.10 2001/06/08 22:47:46 baumannd Exp $
 */
 
 #ifndef USE_GLIBMODULE_METHODS
@@ -46,6 +46,8 @@
 gboolean
 initialise_method_handling (configuration config)
 {
+  g_return_val_if_fail (config, FALSE);
+
   if (g_module_supported ())
     return (TRUE);
   return (FALSE);
@@ -62,6 +64,8 @@
   char abspath[PATH_MAX];
   odl_fieldlist *fields;
 
+  g_return_val_if_fail (config, FALSE);
+
   /* get directory where code files are stored */
   dirname =
     (char *) get_global_option_str (config, "methoddir", DEFAULT_METHOD_DIR);
@@ -175,15 +179,20 @@
 }
 
 CORBA_char *
-execute_method (GEAS_object_reference * obj,
-                const char *methodname, GEAS_Arguments * args,
-                CORBA_Environment * ev)
+execute_method (GEAS_object_reference *obj,
+                const char *methodname, GEAS_Arguments *args,
+                CORBA_Environment *ev)
 {
   char *classname = obj->classname;
   GList *l = provider_list;
   char *mangled = odl_mangle_qualified_name (obj->classname);
   provider_t *p;
   METHODFUNC func;
+
+  g_return_val_if_fail (obj, NULL);
+  g_return_val_if_fail (methodname, NULL);
+  g_return_val_if_fail (args, NULL);
+  g_return_val_if_fail (ev, NULL);
 
   /* message( "looking for method %s in class %s" , methodname , classname ); 
*/
   while (l)
Index: gnue/geas/src/methods/methods_oaf.h
diff -u gnue/geas/src/methods/methods_oaf.h:1.4 
gnue/geas/src/methods/methods_oaf.h:1.5
--- gnue/geas/src/methods/methods_oaf.h:1.4     Fri Jun  8 14:26:45 2001
+++ gnue/geas/src/methods/methods_oaf.h Fri Jun  8 15:47:46 2001
@@ -19,7 +19,7 @@
   along with GEAS; if not, write to the Free Software Foundation, Inc.,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-  $Id: methods_oaf.h,v 1.4 2001/06/08 21:26:45 baumannd Exp $
+  $Id: methods_oaf.h,v 1.5 2001/06/08 22:47:46 baumannd Exp $
 */
 
 #ifndef USE_OAF
@@ -45,7 +45,7 @@
 static GList *provider_list = NULL;
 
 gboolean
-initialise_method_handling (void)
+initialise_method_handling (configuration config)
 {
   GList *cl, *l, *fields, *fl;
   classdata *c;
@@ -56,6 +56,8 @@
   CORBA_Environment ev;
   int fails = 0;
 
+  g_return_val_if_fail (config, FALSE);
+
   CORBA_exception_init (&ev);
 
   /* look for the registered providers for each business method */
@@ -170,6 +172,7 @@
 gboolean
 shutdown_method_handling (void)
 {
+  return (TRUE);
 }
 
 CORBA_char *
@@ -179,6 +182,11 @@
 {
   GList *l = provider_list;
   char *retval = NULL;
+
+  g_return_val_if_fail (obj, NULL);
+  g_return_val_if_fail (methodname, NULL);
+  g_return_val_if_fail (args, NULL);
+  g_return_val_if_fail (ev, NULL);
 
   while (l)
     {
Index: gnue/geas/src/methods/methods_unstable.h
diff -u gnue/geas/src/methods/methods_unstable.h:1.7 
gnue/geas/src/methods/methods_unstable.h:1.8
--- gnue/geas/src/methods/methods_unstable.h:1.7        Fri Jun  8 14:26:45 2001
+++ gnue/geas/src/methods/methods_unstable.h    Fri Jun  8 15:47:46 2001
@@ -19,7 +19,7 @@
   along with GEAS; if not, write to the Free Software Foundation, Inc.,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-  $Id: methods_unstable.h,v 1.7 2001/06/08 21:26:45 baumannd Exp $
+  $Id: methods_unstable.h,v 1.8 2001/06/08 22:47:46 baumannd Exp $
 */
 
 /*
@@ -66,6 +66,9 @@
   PyObject *function;
   char *methodname;
 
+  g_assert (self);
+  g_assert (args);
+
   if (!PyArg_ParseTuple
       (args, "sO:methods_register_python", &methodname, &function))
     {
@@ -100,6 +103,8 @@
   char *buf = NULL;
   PyObject *m, *py_dict;
 
+  g_return_val_if_fail (config, FALSE);
+
   /* start up embedded python interpreter */
   /* this is why this code is considered unstable: it can not enforce */
   /* more than minimal security restrictions, and can not prevent */
@@ -180,6 +185,8 @@
   GList *l, *l2;
   odl_class *c;
 
+  g_return_val_if_fail (config, FALSE);
+
   PyEval_AcquireLock ();
   PyThreadState_Swap (py_threadstate);
 
@@ -284,6 +291,7 @@
 gboolean
 shutdown_method_handling (void)
 {
+  return (TRUE);
 }
 
 CORBA_char *
@@ -300,6 +308,11 @@
   GEAS_DataObject obj2;
   GEAS_Connection serverobj;
 
+  g_return_val_if_fail (obj, NULL);
+  g_return_val_if_fail (methodname, NULL);
+  g_return_val_if_fail (args, NULL);
+  g_return_val_if_fail (ev, NULL);
+
   obj2 =
     make_dataobject_reference (obj->classname, obj->objectid, obj->username,
                                ev);
@@ -398,13 +411,13 @@
   return (retval);
 }
 
-
-
 static int
 load_python_binding (configuration config)
 {
   gpointer gsym;
   CORBA_to_Python_func = NULL;
+
+  g_assert (config);
 
   if (!g_module_supported ())
     {



reply via email to

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