]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move modcall() to unlang_interpret()
authorAlan T. DeKok <aland@freeradius.org>
Fri, 20 May 2016 13:59:03 +0000 (09:59 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 24 May 2016 18:24:10 +0000 (14:24 -0400)
and various other minor cleanups

src/include/interpreter.h
src/main/interpreter.c
src/main/modules.c

index 2eebad0948049a7b2035c5119e9ccde85ba01656..554965c9c8bfb5a6cd9f493dce5145dc9d6666c0 100644 (file)
@@ -132,7 +132,7 @@ static inline modcallable *mod_xlattocallable(modxlat *p)
        return (modcallable *)p;
 }
 
-int modcall(rlm_components_t component, modcallable *c, REQUEST *request);
+rlm_rcode_t unlang_interpret(REQUEST *request, modcallable *c, rlm_components_t component);
 
 #ifdef __cplusplus
 }
index b485ec7c4226a1ea5cfedea2f7c152972c2b2cb8..f3c5dc53c968e10aceb3c5cd4632eb5fb3c8a9a3 100644 (file)
@@ -839,7 +839,7 @@ static bool unlang_brace[MOD_NUM_TYPES] = {
 /*
  *     Interpret the various types of blocks.
  */
-static void unlang_interpret(REQUEST *request, unlang_stack_t *stack, rlm_rcode_t *presult, int *ppriority)
+static void unlang_run(REQUEST *request, unlang_stack_t *stack, rlm_rcode_t *presult, int *ppriority)
 {
        modcallable *c;
        int priority;
@@ -1013,12 +1013,14 @@ static int default_component_results[MOD_COUNT] = {
  *
  * What did Paul Graham say about Lisp...?
  */
-int modcall(rlm_components_t component, modcallable *c, REQUEST *request)
+rlm_rcode_t unlang_interpret(REQUEST *request, modcallable *c, rlm_components_t component)
 {
        int priority;
        rlm_rcode_t result;
        unlang_stack_t stack;
 
+       if (!c) return default_component_results[component];
+
        memset(&stack, 0, sizeof(stack));
 
        result = default_component_results[component];
@@ -1029,7 +1031,7 @@ int modcall(rlm_components_t component, modcallable *c, REQUEST *request)
        /*
         *      Call the main handler.
         */
-       unlang_interpret(request, &stack, &result, &priority);
+       unlang_run(request, &stack, &result, &priority);
 
        /*
         *      Return the result.
index 9e0e639f3acb5efc9cc95f866a3abb42415d4476..f9b2274d90b79ac602caccb6bdff8ba4524eba8c 100644 (file)
@@ -2038,7 +2038,7 @@ static rlm_rcode_t indexed_modcall(rlm_components_t comp, int idx, REQUEST *requ
                request->module = NULL;
                request->component = section_type_value[comp].section;
 
-               rcode = modcall(comp, list, request);
+               rcode = unlang_interpret(request, list, comp);
 
                request->component = component;
                request->module = module;