[PATCH 3/10] rlm_python: 03-cleanup-radius-constants.patch

Paul P Komkoff Jr i at stingr.net
Mon Jan 30 23:19:46 CET 2006


Cleanup radius_constants

---
commit 850e29fc4532bed1394abde8aab371b14f92d5f7
tree 529b8ecb89184be8c779afd81daad1d725e1b511
parent 6050d39e6f0c26ecd73c026fcca6e6a17806a4e3
author <stingray at boxster64.stingr.net> Sun, 29 Jan 2006 15:03:39 +0300
committer <stingray at boxster64.stingr.net> Sun, 29 Jan 2006 15:03:39 +0300

 src/modules/rlm_python/rlm_python.c |   50 ++++++++++++++++++-----------------
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/modules/rlm_python/rlm_python.c b/src/modules/rlm_python/rlm_python.c
--- a/src/modules/rlm_python/rlm_python.c
+++ b/src/modules/rlm_python/rlm_python.c
@@ -129,6 +129,29 @@ static CONF_PARSER module_config[] = {
   { NULL, -1, 0, NULL, NULL }		/* end the list */
 };
 
+static struct {
+        const char*     name;
+        int             value;
+} radiusd_constants[] = {
+        { "L_DBG",              L_DBG                   },
+        { "L_AUTH",             L_AUTH                  },
+        { "L_INFO",             L_INFO                  },
+        { "L_ERR",              L_ERR                   },
+        { "L_PROXY",            L_PROXY                 },
+        { "L_CONS",             L_CONS                  },
+        { "RLM_MODULE_REJECT",  RLM_MODULE_REJECT       },
+        { "RLM_MODULE_FAIL",    RLM_MODULE_FAIL         },
+        { "RLM_MODULE_OK",      RLM_MODULE_OK           },
+        { "RLM_MODULE_HANDLED", RLM_MODULE_HANDLED      },
+        { "RLM_MODULE_INVALID", RLM_MODULE_INVALID      },
+        { "RLM_MODULE_USERLOCK",RLM_MODULE_USERLOCK     },
+        { "RLM_MODULE_NOTFOUND",RLM_MODULE_NOTFOUND     },
+        { "RLM_MODULE_NOOP",    RLM_MODULE_NOOP         },
+        { "RLM_MODULE_UPDATED", RLM_MODULE_UPDATED      },
+        { "RLM_MODULE_NUMCODES",RLM_MODULE_NUMCODES     },
+        { NULL, 0 },
+};
+
 
 /* Let assume that radiusd module is only one since we have only one intepreter */
 
@@ -493,29 +516,6 @@ static int python_function(REQUEST *requ
 }
 
 
-static struct varlookup {
-	const char*	name;
-	int		value;
-} constants[] = {
-	{ "L_DBG",		L_DBG			},
-	{ "L_AUTH",		L_AUTH			},
-	{ "L_INFO",		L_INFO			},
-	{ "L_ERR",		L_ERR			},
-	{ "L_PROXY",		L_PROXY			},
-	{ "L_CONS",		L_CONS			},
-	{ "RLM_MODULE_REJECT",	RLM_MODULE_REJECT	},
-	{ "RLM_MODULE_FAIL",	RLM_MODULE_FAIL		},
-	{ "RLM_MODULE_OK",	RLM_MODULE_OK		},
-	{ "RLM_MODULE_HANDLED",	RLM_MODULE_HANDLED	},
-	{ "RLM_MODULE_INVALID",	RLM_MODULE_INVALID	},
-	{ "RLM_MODULE_USERLOCK",RLM_MODULE_USERLOCK	},
-	{ "RLM_MODULE_NOTFOUND",RLM_MODULE_NOTFOUND	},
-	{ "RLM_MODULE_NOOP",	RLM_MODULE_NOOP		},
-	{ "RLM_MODULE_UPDATED",	RLM_MODULE_UPDATED	},
-	{ "RLM_MODULE_NUMCODES",RLM_MODULE_NUMCODES	},
-	{ NULL, 0 },
-};
-
 /*
  * Import a user module and load a function from it
  */
@@ -604,8 +604,8 @@ static int python_instantiate(CONF_SECTI
     /*
      * Load constants into module
      */
-    for (idx=0; constants[idx].name; idx++)
-	if ((PyModule_AddIntConstant(radiusd_module, constants[idx].name, constants[idx].value)) == -1) {
+    for (idx=0; radiusd_constants[idx].name; idx++)
+	if ((PyModule_AddIntConstant(radiusd_module, radiusd_constants[idx].name, radiusd_constants[idx].value)) == -1) {
 
 	    radlog(L_ERR, "Python AddIntConstant failed");
 	}
-- 
Paul P 'Stingray' Komkoff Jr // http://stingr.net/key <- my pgp key
 This message represents the official view of the voices in my head



More information about the Freeradius-Devel mailing list