summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs/mprutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting/ejs/mprutil.c')
-rw-r--r--source4/scripting/ejs/mprutil.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/scripting/ejs/mprutil.c b/source4/scripting/ejs/mprutil.c
index 2a1036d9a4..cd5ec3b5cd 100644
--- a/source4/scripting/ejs/mprutil.c
+++ b/source4/scripting/ejs/mprutil.c
@@ -213,3 +213,29 @@ struct MprVar mprWERROR(WERROR status)
return res;
}
+
+
+/*
+ set a pointer in a existing MprVar
+*/
+void mprSetPtr(struct MprVar *v, const char *propname, void *p)
+{
+ struct MprVar val = mprCreatePtrVar(p, talloc_get_name(p));
+ mprCreateProperty(v, propname, &val);
+}
+
+/*
+ get a pointer from a MprVar
+*/
+void *mprGetPtr(struct MprVar *v, const char *propname)
+{
+ struct MprVar *val;
+ val = mprGetProperty(v, propname, NULL);
+ if (val == NULL) {
+ return NULL;
+ }
+ if (val->type != MPR_TYPE_PTR) {
+ return NULL;
+ }
+ return val->ptr;
+}