]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove 'const' from resume_ctx
authorAlan T. DeKok <aland@freeradius.org>
Tue, 29 Aug 2017 11:15:28 +0000 (07:15 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 29 Aug 2017 11:38:46 +0000 (07:38 -0400)
The whole point of resuming is to modify the ctx...

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

index 1f49dce1b1c644f4516e24ee277dc00f73b0423e..1a4a9fce17be1b2f074ed93b611a43d209c2d52d 100644 (file)
@@ -175,7 +175,7 @@ typedef struct {
                                                        //!< may be removed in future.
 
 
-       void const                      *resume_ctx;    //!< Context data for the callback.  Usually represents
+       void                            *resume_ctx;    //!< Context data for the callback.  Usually represents
                                                        //!< the module's internal state at the time of yielding.
        void const                      *instance;      //!< instance data
        void                            *thread;        //!< thread data
index 0cbd8cbc6ff80e5566feda289472d933f7c27ab1..65cff8e62673d985dccd91a8adddf2583addc21a 100644 (file)
@@ -304,7 +304,7 @@ void                unlang_resumable(REQUEST *request);
 void           unlang_signal(REQUEST *request, fr_state_action_t action);
 
 rlm_rcode_t    unlang_module_yield(REQUEST *request, fr_unlang_resume_callback_t callback, fr_unlang_action_t signal_callback,
-                            void const *ctx);
+                            void *ctx);
 
 #ifdef __cplusplus
 }
index 2fb9094e3f3b2b74f9ade7c6322a464a1f954fd3..630d352a5232768c36ed121a11f7671e4aaf3320 100644 (file)
@@ -487,7 +487,7 @@ static rlm_rcode_t unlang_run(REQUEST *request, unlang_stack_t *stack);
  */
 static unlang_resume_t *unlang_resume_alloc(REQUEST *request,
                                            fr_unlang_resume_callback_t callback,
-                                           fr_unlang_action_t signal_callback, void const *ctx)
+                                           fr_unlang_action_t signal_callback, void *ctx)
 {
        unlang_resume_t                 *mr;
        unlang_stack_t                  *stack = request->stack;
@@ -1301,12 +1301,10 @@ static unlang_action_t unlang_resume(REQUEST *request, unlang_stack_t *stack,
        unlang_t                        *instruction = frame->instruction;
        unlang_resume_t                 *mr = unlang_generic_to_resume(instruction);
        unlang_stack_state_modcall_t    *modcall_state = NULL;
-       void                            *resume_ctx;
        void                            *instance;
 
        RDEBUG3("Resuming in %s", mr->self.debug_name);
 
-       memcpy(&resume_ctx, &mr->resume_ctx, sizeof(resume_ctx));
        memcpy(&instance, &mr->instance, sizeof(instance));
        request->module = mr->self.debug_name;
 
@@ -1314,7 +1312,7 @@ static unlang_action_t unlang_resume(REQUEST *request, unlang_stack_t *stack,
         *      Do the internal resume function.
         */
        if (unlang_ops_resume[mr->parent_type]) {
-               *presult = request->rcode = unlang_ops_resume[mr->parent_type](request, stack, instance, mr->thread, resume_ctx);
+               *presult = request->rcode = unlang_ops_resume[mr->parent_type](request, stack, instance, mr->thread, mr->resume_ctx);
 
        } else {
                rad_assert(mr->parent_type == UNLANG_TYPE_MODULE_CALL);
@@ -1326,7 +1324,7 @@ static unlang_action_t unlang_resume(REQUEST *request, unlang_stack_t *stack,
                 *      Lock is noop unless instance->mutex is set.
                 */
                safe_lock(mr->module_instance);
-               *presult = request->rcode = mr->callback(request, instance, mr->thread, resume_ctx);
+               *presult = request->rcode = mr->callback(request, instance, mr->thread, mr->resume_ctx);
                safe_unlock(mr->module_instance);
        }
 
@@ -2222,7 +2220,6 @@ void unlang_signal(REQUEST *request, fr_state_action_t action)
        unlang_stack_frame_t            *frame;
        unlang_stack_t                  *stack = request->stack;
        unlang_resume_t                 *mr;
-       void                            *resume_ctx;
        void                            *instance;
 
        rad_assert(stack->depth > 0);
@@ -2239,10 +2236,9 @@ void unlang_signal(REQUEST *request, fr_state_action_t action)
        mr = unlang_generic_to_resume(frame->instruction);
        if (!mr->signal_callback) return;
 
-       memcpy(&resume_ctx, &mr->resume_ctx, sizeof(resume_ctx));
        memcpy(&instance, &mr->instance, sizeof(instance));
 
-       mr->signal_callback(request, instance, mr->thread, resume_ctx, action);
+       mr->signal_callback(request, instance, mr->thread, mr->resume_ctx, action);
 }
 
 /** Yield a request back to the interpreter from within a module
@@ -2262,7 +2258,7 @@ void unlang_signal(REQUEST *request, fr_state_action_t action)
  * @return always returns RLM_MODULE_YIELD.
  */
 rlm_rcode_t unlang_module_yield(REQUEST *request, fr_unlang_resume_callback_t callback,
-                               fr_unlang_action_t signal_callback, void const *ctx)
+                               fr_unlang_action_t signal_callback, void *ctx)
 {
        unlang_stack_t                  *stack = request->stack;
        unlang_stack_frame_t            *frame = &stack->frame[stack->depth];