From: Alan T. DeKok Date: Fri, 20 May 2016 13:59:03 +0000 (-0400) Subject: move modcall() to unlang_interpret() X-Git-Tag: branch_3_1_x~334 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bc220fcb9c1e93ff95317a2b06ff5e961007d9d;p=thirdparty%2Ffreeradius-server.git move modcall() to unlang_interpret() and various other minor cleanups --- diff --git a/src/include/interpreter.h b/src/include/interpreter.h index 2eebad09480..554965c9c8b 100644 --- a/src/include/interpreter.h +++ b/src/include/interpreter.h @@ -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 } diff --git a/src/main/interpreter.c b/src/main/interpreter.c index b485ec7c422..f3c5dc53c96 100644 --- a/src/main/interpreter.c +++ b/src/main/interpreter.c @@ -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. diff --git a/src/main/modules.c b/src/main/modules.c index 9e0e639f3ac..f9b2274d90b 100644 --- a/src/main/modules.c +++ b/src/main/modules.c @@ -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;