From: Nick Porter Date: Mon, 9 Jun 2025 15:29:51 +0000 (+0100) Subject: Add Ptr class to use for passing C pointers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ed79ecd6e40dc18c0d6e3f1a42007c740288472;p=thirdparty%2Ffreeradius-server.git Add Ptr class to use for passing C pointers --- diff --git a/src/modules/rlm_mruby/rlm_mruby.c b/src/modules/rlm_mruby/rlm_mruby.c index 31ffdfa6fc7..ce8252171cd 100644 --- a/src/modules/rlm_mruby/rlm_mruby.c +++ b/src/modules/rlm_mruby/rlm_mruby.c @@ -201,6 +201,9 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) /* Define the Request class */ inst->mruby_request = mruby_request_class(mrb, inst->mruby_module); + inst->mruby_ptr = mrb_define_class_under(mrb, inst->mruby_module, "Ptr", mrb->object_class); + MRB_SET_INSTANCE_TT(inst->mruby_ptr, MRB_TT_DATA); + DEBUG("Loading file %s...", inst->filename); f = fopen(inst->filename, "r"); if (!f) { diff --git a/src/modules/rlm_mruby/rlm_mruby.h b/src/modules/rlm_mruby/rlm_mruby.h index 328724eb888..0a9a5796ffb 100644 --- a/src/modules/rlm_mruby/rlm_mruby.h +++ b/src/modules/rlm_mruby/rlm_mruby.h @@ -48,6 +48,7 @@ typedef struct { struct RClass *mruby_module; struct RClass *mruby_request; + struct RClass *mruby_ptr; mrb_value mrubyconf_hash; } rlm_mruby_t;