[Openvas-commits] r398 - in trunk/openvas-server: . openvasd

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Sep 20 15:02:58 CEST 2007


Author: bh
Date: 2007-09-20 15:02:57 +0200 (Thu, 20 Sep 2007)
New Revision: 398

Modified:
   trunk/openvas-server/ChangeLog
   trunk/openvas-server/openvasd/pluginload.c
Log:
* openvasd/pluginload.c (init_plugin_classes)
(plugins_reload_from_dir): Refactor the initialization of the
plugin classes to from plugins_reload_from_dir into the new
function init_plugin_classes


Modified: trunk/openvas-server/ChangeLog
===================================================================
--- trunk/openvas-server/ChangeLog	2007-09-19 00:33:06 UTC (rev 397)
+++ trunk/openvas-server/ChangeLog	2007-09-20 13:02:57 UTC (rev 398)
@@ -1,3 +1,10 @@
+2007-09-20  Bernhard Herzog  <bh at intevation.de>
+
+	* openvasd/pluginload.c (init_plugin_classes)
+	(plugins_reload_from_dir): Refactor the initialization of the
+	plugin classes to from plugins_reload_from_dir into the new
+	function init_plugin_classes
+
 2007-07-27  Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
 
 	Doing the 0.9.0 release.

Modified: trunk/openvas-server/openvasd/pluginload.c
===================================================================
--- trunk/openvas-server/openvasd/pluginload.c	2007-09-19 00:33:06 UTC (rev 397)
+++ trunk/openvas-server/openvasd/pluginload.c	2007-09-20 13:02:57 UTC (rev 398)
@@ -126,8 +126,29 @@
  return plugins_reload(preferences, emalloc(sizeof(struct arglist)), be_quiet);
 }
 
+static void
+init_plugin_classes(struct arglist * preferences)
+{
+  if (plugin_classes == NULL)
+    {
+      pl_class_t ** cl_pptr = &plugin_classes;
+      pl_class_t * cl_ptr;
+      int i;
+      pl_class_t* classes[] = {&nes_plugin_class, &nasl_plugin_class, NULL};
 
+      for (i = 0; (cl_ptr = classes[i]); ++i)
+	{
+	  if ((*cl_ptr->pl_init)(preferences, NULL))
+	    {
+	      *cl_pptr = cl_ptr;
+	      cl_ptr->pl_next = NULL;
+	      cl_pptr = &cl_ptr->pl_next;
+	    }
+	}
+    }
+}
 
+
 static struct arglist * 
 plugins_reload_from_dir(preferences, plugins, folder, be_quiet)
  struct arglist * preferences;
@@ -141,30 +162,9 @@
   char * name;
   int idx = 0;
   int n = 0, total = 0, num_files = 0;
-  
-  if( plugin_classes == NULL){
-   pl_class_t ** cl_pptr = &plugin_classes;
-   pl_class_t * cl_ptr;
-   int i;
-   pl_class_t*  pl_init_classes[] = {
-   			&nes_plugin_class,
-			&nasl_plugin_class,
-#ifdef PERL_PLUGINS
-			&perl_plugin_class,
-#endif
-			NULL 
-		};
-		
-  for (i = 0;  (cl_ptr = pl_init_classes[i]);  ++i) {
-	    if ((*cl_ptr->pl_init)(preferences, NULL)) {
-	        *cl_pptr = cl_ptr;
-		cl_ptr->pl_next = NULL;
-		cl_pptr = &cl_ptr->pl_next;
-	    }
-	}
-    }
-  
-  
+
+  init_plugin_classes(preferences);
+
   if( folder == NULL)
     {
 #ifdef DEBUG



More information about the Openvas-commits mailing list