diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-02 05:21:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:04 -0500 |
commit | 643e5d8239ba105a5ac99ecc513289a17402714b (patch) | |
tree | bdf23033fca7be2f84191ca5dc996d066732b0a1 /source4/scripting/ejs/mprutil.c | |
parent | e7f84503c059b99541cb892cd143c87ed8626d69 (diff) | |
download | samba-643e5d8239ba105a5ac99ecc513289a17402714b.tar.gz samba-643e5d8239ba105a5ac99ecc513289a17402714b.tar.bz2 samba-643e5d8239ba105a5ac99ecc513289a17402714b.zip |
r8069: the beginnings of code to allow rpc calls to be made from ejs
tpot, note that this shows how you can modify passed in MprVar
variables in C call
(This used to be commit a782541db3de6ca3b599a220265cf9e6cb0c4d7b)
Diffstat (limited to 'source4/scripting/ejs/mprutil.c')
-rw-r--r-- | source4/scripting/ejs/mprutil.c | 26 |
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; +} |