[Openvas-commits] r12007 - in branches/openvas-libraries-4-0: . nasl

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Nov 7 08:24:06 CET 2011


Author: mwiegand
Date: 2011-11-07 08:24:02 +0100 (Mon, 07 Nov 2011)
New Revision: 12007

Modified:
   branches/openvas-libraries-4-0/ChangeLog
   branches/openvas-libraries-4-0/nasl/nasl_func.c
   branches/openvas-libraries-4-0/nasl/nasl_var.c
Log:
* nasl/nasl_func.c (get_func), nasl/nasl_var.c (get_var_ref_by_name):
  removed dead code contained in #ifdef SILLY_OPT checks. Backport from
  SVN trunk, originally committed by Henri Doreau in r11111.


Modified: branches/openvas-libraries-4-0/ChangeLog
===================================================================
--- branches/openvas-libraries-4-0/ChangeLog	2011-11-07 07:07:44 UTC (rev 12006)
+++ branches/openvas-libraries-4-0/ChangeLog	2011-11-07 07:24:02 UTC (rev 12007)
@@ -1,3 +1,9 @@
+2011-11-07  Michael Wiegand <michael.wiegand at greenbone.net>
+
+	* nasl/nasl_func.c (get_func), nasl/nasl_var.c (get_var_ref_by_name):
+	removed dead code contained in #ifdef SILLY_OPT checks. Backport from
+	SVN trunk, originally committed by Henri Doreau in r11111.
+
 2011-11-03  Michael Wiegand <michael.wiegand at greenbone.net>
 
 	Post release version bump.

Modified: branches/openvas-libraries-4-0/nasl/nasl_func.c
===================================================================
--- branches/openvas-libraries-4-0/nasl/nasl_func.c	2011-11-07 07:07:44 UTC (rev 12006)
+++ branches/openvas-libraries-4-0/nasl/nasl_func.c	2011-11-07 07:24:02 UTC (rev 12007)
@@ -47,28 +47,14 @@
 static nasl_func *
 get_func (lex_ctxt * ctxt, const char *name, int h)
 {
-  nasl_func *v, *prev;
+  nasl_func *v;
   lex_ctxt *c;
 
   for (c = ctxt; c != NULL; c = c->up_ctxt)
     {
-      for (prev = NULL, v = c->functions[h]; v != NULL; v = v->next_func)
+      for (v = c->functions[h]; v != NULL; v = v->next_func)
         if (v->func_name != NULL && strcmp (name, v->func_name) == 0)
-          {
-#ifdef SILLY_OPT
-            if (prev != NULL)   /* Move it to start of list */
-              {
-                prev->next_func = v->next_func;
-                v->next_func = c->functions[h];
-                c->functions[h] = v;
-              }
-#endif
-            return v;
-          }
-#ifdef SILLY_OPT
-        else
-          prev = v;
-#endif
+          return v;
     }
 
   return NULL;

Modified: branches/openvas-libraries-4-0/nasl/nasl_var.c
===================================================================
--- branches/openvas-libraries-4-0/nasl/nasl_var.c	2011-11-07 07:07:44 UTC (rev 12006)
+++ branches/openvas-libraries-4-0/nasl/nasl_var.c	2011-11-07 07:24:02 UTC (rev 12007)
@@ -126,7 +126,7 @@
 static named_nasl_var *
 get_var_ref_by_name (lex_ctxt * ctxt, const char *name, int climb)
 {
-  named_nasl_var *v, *prev;
+  named_nasl_var *v;
   int h = hash_str (name);
   lex_ctxt *c;
 
@@ -134,46 +134,16 @@
     {
       for (c = ctxt; c != NULL; c = c->up_ctxt)
         if (c->ctx_vars.hash_elt != NULL)
-          for (prev = NULL, v = c->ctx_vars.hash_elt[h]; v != NULL;
-               v = v->next_var)
+          for (v = c->ctx_vars.hash_elt[h]; v != NULL; v = v->next_var)
             if (v->var_name != NULL && strcmp (name, v->var_name) == 0)
-              {
-#ifdef SILLY_OPT
-                if (prev != NULL)       /* Move it to start of list */
-                  {
-                    prev->next_var = v->next_var;
-                    v->next_var = c->ctx_vars.hash_elt[h];
-                    c->ctx_vars.hash_elt[h] = v;
-                  }
-#endif
-                return v;
-              }
-#ifdef SILLY_OPT
-            else
-              prev = v;
-#endif
+              return v;
     }
   else
     {
       if (ctxt->ctx_vars.hash_elt != NULL)
-        for (prev = NULL, v = ctxt->ctx_vars.hash_elt[h]; v != NULL;
-             v = v->next_var)
+        for (v = ctxt->ctx_vars.hash_elt[h]; v != NULL; v = v->next_var)
           if (v->var_name != NULL && strcmp (name, v->var_name) == 0)
-            {
-#ifdef SILLY_OPT
-              if (prev != NULL) /* Move it to start of list */
-                {
-                  prev->next_var = v->next_var;
-                  v->next_var = ctxt->ctx_vars.hash_elt[h];
-                  ctxt->ctx_vars.hash_elt[h] = v;
-                }
-#endif
-              return v;
-            }
-#ifdef SILLY_OPT
-          else
-            prev = v;
-#endif
+            return v;
     }
 
   if (ctxt->ctx_vars.hash_elt == NULL)



More information about the Openvas-commits mailing list