summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-11 22:40:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:20:07 -0500
commitba1ee57df43fe93c8b650478324ddd6cc1a3c7bc (patch)
tree520287c2e17509ba1d9a9895b986a1a59a945e80
parent3e5649f79f910c9cad96a362d679f34453e60fa9 (diff)
downloadsamba-ba1ee57df43fe93c8b650478324ddd6cc1a3c7bc.tar.gz
samba-ba1ee57df43fe93c8b650478324ddd6cc1a3c7bc.tar.bz2
samba-ba1ee57df43fe93c8b650478324ddd6cc1a3c7bc.zip
r8333: merged with latest upstream ejs sources
(This used to be commit b0f9ddafe95d4e8d846bc72a39e94d22da271348)
-rw-r--r--source4/lib/ejs/config.mk2
-rw-r--r--source4/lib/ejs/ejs.h16
-rw-r--r--source4/lib/ejs/ejsInternal.h5
-rw-r--r--source4/lib/ejs/ejsLex.c5
-rw-r--r--source4/lib/ejs/ejsLib.c (renamed from source4/lib/ejs/ejs.c)21
-rw-r--r--source4/lib/ejs/ejsParser.c16
-rw-r--r--source4/lib/ejs/ejsProcs.c2
-rw-r--r--source4/lib/ejs/var.c50
-rw-r--r--source4/lib/ejs/var.h25
-rw-r--r--source4/scripting/ejs/ejsrpc.c2
-rw-r--r--source4/scripting/ejs/mprutil.c6
-rw-r--r--source4/scripting/ejs/smbcalls_cli.c11
-rw-r--r--source4/scripting/ejs/smbcalls_rpc.c2
13 files changed, 93 insertions, 70 deletions
diff --git a/source4/lib/ejs/config.mk b/source4/lib/ejs/config.mk
index 2d436cbe0b..f2c0e62f1e 100644
--- a/source4/lib/ejs/config.mk
+++ b/source4/lib/ejs/config.mk
@@ -2,7 +2,7 @@
# Start SUBSYSTEM EJS
[SUBSYSTEM::EJS]
ADD_OBJ_FILES = \
- lib/ejs/ejs.o \
+ lib/ejs/ejsLib.o \
lib/ejs/ejsLex.o \
lib/ejs/ejsParser.o \
lib/ejs/ejsProcs.o \
diff --git a/source4/lib/ejs/ejs.h b/source4/lib/ejs/ejs.h
index 79216d4712..f1d2bb4c6e 100644
--- a/source4/lib/ejs/ejs.h
+++ b/source4/lib/ejs/ejs.h
@@ -44,8 +44,8 @@
#ifndef _h_EJS
#define _h_EJS 1
-#include "lib/ejs/miniMpr.h"
-#include "lib/ejs/var.h"
+#include "miniMpr.h"
+#include "var.h"
#ifdef __cplusplus
extern "C" {
@@ -75,7 +75,7 @@ extern void ejsCloseEngine(EjsId eid);
* Evaluation functions
*/
extern int ejsEvalFile(EjsId eid, char *path, MprVar *result, char **emsg);
-extern int ejsEvalScript(EjsId eid, char *script, MprVar *result,
+extern int ejsEvalScript(EjsId eid, char *script, MprVar *result,
char **emsg);
extern int ejsRunFunction(int eid, MprVar *obj, const char *functionName,
MprArray *args);
@@ -87,7 +87,8 @@ extern int ejsRunFunction(int eid, MprVar *obj, const char *functionName,
extern MprVar ejsCreateObj(const char *name, int hashSize);
extern MprVar ejsCreateArray(const char *name, int hashSize);
extern bool ejsDestroyVar(MprVar *obj);
-extern int ejsCopyVar(EjsId eid, const char *var, MprVar *value, bool copyRef);
+extern int ejsCopyVar(EjsId eid, const char *var, MprVar *value,
+ bool copyRef);
extern int ejsReadVar(EjsId eid, const char *var, MprVar *value);
extern int ejsWriteVar(EjsId eid, const char *var, MprVar *value);
extern int ejsWriteVarValue(EjsId eid, const char *var, MprVar value);
@@ -99,8 +100,8 @@ extern MprVar *ejsGetGlobalObject(EjsId eid);
/*
* Function routines
*/
-extern void ejsDefineFunction(EjsId eid, const char *functionName, char *args,
- char *body);
+extern void ejsDefineFunction(EjsId eid, const char *functionName,
+ char *args, char *body);
extern void ejsDefineCFunction(EjsId eid, const char *functionName,
MprCFunction fn, void *thisPtr, int flags);
extern void ejsDefineStringCFunction(EjsId eid, const char *functionName,
@@ -109,7 +110,8 @@ extern void *ejsGetThisPtr(EjsId eid);
extern MprVar *ejsGetReturnValue(EjsId eid);
extern int ejsGetLineNumber(EjsId eid);
extern int ejsParseArgs(int argc, char **argv, char *fmt, ...);
-extern void ejsSetErrorMsg(EjsId eid, const char* fmt, ...) PRINTF_ATTRIBUTE(2,3);
+extern void ejsSetErrorMsg(EjsId eid, const char* fmt, ...)
+ PRINTF_ATTRIBUTE(2,3);
extern void ejsSetReturnValue(EjsId eid, MprVar value);
extern void ejsSetReturnString(EjsId eid, const char *str);
diff --git a/source4/lib/ejs/ejsInternal.h b/source4/lib/ejs/ejsInternal.h
index 4d54c4e8c6..3bf99d88b9 100644
--- a/source4/lib/ejs/ejsInternal.h
+++ b/source4/lib/ejs/ejsInternal.h
@@ -39,7 +39,7 @@
#ifndef _h_EJS_INTERNAL
#define _h_EJS_INTERNAL 1
-#include "lib/ejs/ejs.h"
+#include "ejs.h"
/********************************** Defines ***********************************/
@@ -253,7 +253,8 @@ extern void ejsLexPutbackToken(Ejs* ep, int tid, char *string);
/*
* Parsing
*/
-extern MprVar *ejsFindObj(Ejs *ep, int state, const char *property, int flags);
+extern MprVar *ejsFindObj(Ejs *ep, int state, const char *property,
+ int flags);
extern MprVar *ejsFindProperty(Ejs *ep, int state, MprVar *obj,
char *property, int flags);
extern int ejsGetVarCore(Ejs *ep, const char *var, MprVar **obj,
diff --git a/source4/lib/ejs/ejsLex.c b/source4/lib/ejs/ejsLex.c
index b0d6483c2a..6dcc1c7b78 100644
--- a/source4/lib/ejs/ejsLex.c
+++ b/source4/lib/ejs/ejsLex.c
@@ -36,7 +36,7 @@
*/
/********************************** Includes **********************************/
-#include "lib/ejs/ejsInternal.h"
+#include "ejsInternal.h"
#if BLD_FEATURE_EJS
@@ -439,6 +439,9 @@ static int getLexicalToken(Ejs *ep, int state)
*/
while (1) {
if ((c = inputGetc(ep)) < 0) {
+ if (style == '/') {
+ return EJS_TOK_EOF;
+ }
ejsError(ep, "Syntax Error");
return EJS_TOK_ERR;
}
diff --git a/source4/lib/ejs/ejs.c b/source4/lib/ejs/ejsLib.c
index 41af795370..caae5b6495 100644
--- a/source4/lib/ejs/ejs.c
+++ b/source4/lib/ejs/ejsLib.c
@@ -35,7 +35,7 @@
*/
/********************************** Includes **********************************/
-#include "lib/ejs/ejsInternal.h"
+#include "ejsInternal.h"
#if BLD_FEATURE_EJS
@@ -275,11 +275,11 @@ int ejsEvalFile(EjsId eid, char *path, MprVar *result, char **emsg)
if ((script = (char*) mprMalloc(sbuf.st_size + 1)) == NULL) {
close(fd);
- ejsError(ep, "Cant malloc %d", (int)sbuf.st_size);
+ ejsError(ep, "Cant malloc %d", (int) sbuf.st_size);
goto error;
}
- if (read(fd, script, sbuf.st_size) != (int)sbuf.st_size) {
+ if (read(fd, script, sbuf.st_size) != (int) sbuf.st_size) {
close(fd);
mprFree(script);
ejsError(ep, "Error reading %s", path);
@@ -468,7 +468,8 @@ int ejsEvalScript(EjsId eid, char *script, MprVar *vp, char **emsg)
* Core error handling
*/
-static void ejsErrorCore(Ejs* ep, const char *fmt, va_list args) PRINTF_ATTRIBUTE(2, 0);
+static void ejsErrorCore(Ejs* ep, const char *fmt, va_list args)
+ PRINTF_ATTRIBUTE(2, 0);
static void ejsErrorCore(Ejs* ep, const char *fmt, va_list args)
{
@@ -795,7 +796,8 @@ void ejsDefineStringCFunction(EjsId eid, const char *functionName,
* Body should not contain braces.
*/
-void ejsDefineFunction(EjsId eid, const char *functionName, char *args, char *body)
+void ejsDefineFunction(EjsId eid, const char *functionName, char *args,
+ char *body)
{
MprVar v;
@@ -831,8 +833,8 @@ void *ejsGetThisPtr(EjsId eid)
* indicies. Returns -1 on errors or if the variable is not found.
*/
-int ejsGetVarCore(Ejs *ep, const char *varName_c, MprVar **obj, MprVar **varValue,
- int flags)
+int ejsGetVarCore(Ejs *ep, const char *vname, MprVar **obj,
+ MprVar **varValue, int flags)
{
MprVar *currentObj;
MprVar *currentVar;
@@ -845,12 +847,11 @@ int ejsGetVarCore(Ejs *ep, const char *varName_c, MprVar **obj, MprVar **varValu
if (varValue) {
*varValue = 0;
}
- currentObj = ejsFindObj(ep, 0, varName_c, flags);
+ currentObj = ejsFindObj(ep, 0, vname, flags);
currentVar = 0;
propertyName = 0;
- varName = mprStrdup(varName_c);
- next = varName;
+ next = varName = mprStrdup(vname);
token = getNextVarToken(&next, tokBuf, sizeof(tokBuf));
diff --git a/source4/lib/ejs/ejsParser.c b/source4/lib/ejs/ejsParser.c
index 72b0889c55..a5c40e593d 100644
--- a/source4/lib/ejs/ejsParser.c
+++ b/source4/lib/ejs/ejsParser.c
@@ -35,7 +35,7 @@
/********************************** Includes **********************************/
-#include "lib/ejs/ejsInternal.h"
+#include "ejsInternal.h"
#if BLD_FEATURE_EJS
@@ -1128,9 +1128,11 @@ static int parseFunctionDec(Ejs *ep, int state, int flags)
mprDestroyVar(&v);
return EJS_STATE_ERR;
}
-
- /* register the function name early to allow for recursive
- function calls (see note in ECMA standard, page 71) */
+
+ /*
+ * Register the function name early to allow for recursive
+ * function calls (see note in ECMA standard, page 71)
+ */
if (!(flags & EJS_FLAGS_ASSIGNMENT)) {
currentObj = ejsFindObj(ep, 0, procName, flags);
vp = mprSetProperty(currentObj, procName, &v);
@@ -2127,7 +2129,8 @@ static int evalFunction(Ejs *ep, MprVar *obj, int flags)
* Run a function
*/
-int ejsRunFunction(int eid, MprVar *obj, const char *functionName, MprArray *args)
+int ejsRunFunction(int eid, MprVar *obj, const char *functionName,
+ MprArray *args)
{
EjsProc proc, *saveProc;
Ejs *ep;
@@ -2284,7 +2287,8 @@ static void appendValue(MprVar *dest, MprVar *src)
oldLen = strlen(oldBuf);
buf = mprRealloc(oldBuf, (len + oldLen + 1) * sizeof(char));
dest->string = buf;
- strncpy(&buf[oldLen], value, len+1);
+ strcpy(&buf[oldLen], value);
+
} else {
*dest = mprCreateStringVar(value, 1);
}
diff --git a/source4/lib/ejs/ejsProcs.c b/source4/lib/ejs/ejsProcs.c
index e9932406ad..c01f411161 100644
--- a/source4/lib/ejs/ejsProcs.c
+++ b/source4/lib/ejs/ejsProcs.c
@@ -34,7 +34,7 @@
*/
/********************************** Includes **********************************/
-#include "lib/ejs/ejsInternal.h"
+#include "ejsInternal.h"
#if BLD_FEATURE_EJS
diff --git a/source4/lib/ejs/var.c b/source4/lib/ejs/var.c
index 70a277ae73..2ba56987dd 100644
--- a/source4/lib/ejs/var.c
+++ b/source4/lib/ejs/var.c
@@ -44,7 +44,7 @@
/********************************** Includes **********************************/
-#include "lib/ejs/var.h"
+#include "var.h"
/*********************************** Locals ***********************************/
#if VAR_DEBUG
@@ -344,7 +344,8 @@ MprType mprGetVarType(MprVar *vp)
* already exists in the object, then just write its value.
*/
-MprVar *mprCreateProperty(MprVar *obj, const char *propertyName, MprVar *newValue)
+MprVar *mprCreateProperty(MprVar *obj, const char *propertyName,
+ MprVar *newValue)
{
MprVar *prop, *last;
int bucketIndex;
@@ -376,7 +377,7 @@ MprVar *mprCreateProperty(MprVar *obj, const char *propertyName, MprVar *newValu
}
if (prop) {
- /* FUTURE -- remove. Just for debug. */
+ /* FUTURE -- remove. Just for debug. */
mprAssert(prop == 0);
mprLog(0, "Attempting to create property %s in object %s\n",
propertyName, obj->name);
@@ -428,7 +429,8 @@ MprVar *mprCreateProperty(MprVar *obj, const char *propertyName, MprVar *newValu
* by pointer.
*/
-MprVar *mprCreatePropertyValue(MprVar *obj, const char *propertyName, MprVar newValue)
+MprVar *mprCreatePropertyValue(MprVar *obj, const char *propertyName,
+ MprVar newValue)
{
return mprCreateProperty(obj, propertyName, &newValue);
}
@@ -513,7 +515,8 @@ MprVar *mprSetProperty(MprVar *obj, const char *propertyName, MprVar *newValue)
* new value is passed by value rather than by pointer.
*/
-MprVar *mprSetPropertyValue(MprVar *obj, const char *propertyName, MprVar newValue)
+MprVar *mprSetPropertyValue(MprVar *obj, const char *propertyName,
+ MprVar newValue)
{
return mprSetProperty(obj, propertyName, &newValue);
}
@@ -602,7 +605,7 @@ MprVar *mprGetProperty(MprVar *obj, const char *property, MprVar *value)
for (prop = getObjChain(obj->properties, property); prop;
prop = prop->forw) {
- if (prop->name &&
+ if (prop->name &&
prop->name[0] == property[0] && strcmp(prop->name, property) == 0) {
break;
}
@@ -1170,7 +1173,8 @@ MprVar mprCreateCFunctionVar(MprCFunction fn, void *thisPtr, int flags)
* Initialize a C function.
*/
-MprVar mprCreateStringCFunctionVar(MprStringCFunction fn, void *thisPtr, int flags)
+MprVar mprCreateStringCFunctionVar(MprStringCFunction fn, void *thisPtr,
+ int flags)
{
MprVar v;
@@ -1183,13 +1187,14 @@ MprVar mprCreateStringCFunctionVar(MprStringCFunction fn, void *thisPtr, int fla
return v;
}
+/******************************************************************************/
/*
- * Initialize an opaque pointer.
+ * Initialize an opaque pointer.
*/
-MprVar mprCreatePtrVar(void *ptr, const char *name)
+MprVar mprCreatePtrVar(void *ptr)
{
- MprVar v;
+ MprVar v;
memset(&v, 0x0, sizeof(v));
v.type = MPR_TYPE_PTR;
@@ -1356,7 +1361,7 @@ MprVar mprCreateStringVar(const char *value, bool allocate)
v.string = mprStrdup(value);
v.allocatedData = 1;
} else {
- v.string = value;
+ v.string = (char*) value;
}
return v;
}
@@ -1410,14 +1415,14 @@ static void copyVarCore(MprVar *dest, MprVar *src, int copyDepth)
dest->boolean = src->boolean;
break;
- case MPR_TYPE_STRING_CFUNCTION:
- dest->cFunctionWithStrings = src->cFunctionWithStrings;
- break;
-
case MPR_TYPE_PTR:
dest->ptr = src->ptr;
break;
+ case MPR_TYPE_STRING_CFUNCTION:
+ dest->cFunctionWithStrings = src->cFunctionWithStrings;
+ break;
+
case MPR_TYPE_CFUNCTION:
dest->cFunction = src->cFunction;
break;
@@ -1617,6 +1622,10 @@ void mprVarToString(char** out, int size, char *fmt, MprVar *obj)
*out = mprStrdup("null");
break;
+ case MPR_TYPE_PTR:
+ mprAllocSprintf(out, size, "[Opaque Pointer %p]", obj->ptr);
+ break;
+
case MPR_TYPE_BOOL:
if (obj->boolean) {
*out = mprStrdup("true");
@@ -1665,16 +1674,12 @@ void mprVarToString(char** out, int size, char *fmt, MprVar *obj)
mprAllocSprintf(out, size, "[C StringFunction]");
break;
- case MPR_TYPE_PTR:
- mprAllocSprintf(out, size, "[C Pointer: %p]", obj->ptr);
- break;
-
case MPR_TYPE_FUNCTION:
mprAllocSprintf(out, size, "[JavaScript Function]");
break;
case MPR_TYPE_OBJECT:
- /* FUTURE -- really want: [object class: name] */
+ /* FUTURE -- really want: [object class: name] */
mprAllocSprintf(out, size, "[object %s]", obj->name);
break;
@@ -1753,6 +1758,7 @@ MprVar mprParseVar(char *buf, MprType preferredType)
case MPR_TYPE_OBJECT:
case MPR_TYPE_UNDEFINED:
case MPR_TYPE_NULL:
+ case MPR_TYPE_PTR:
default:
break;
@@ -2157,7 +2163,7 @@ bool mprIsNan(double f)
#if WIN
return _isnan(f);
#elif VXWORKS
- /* FUTURE */
+ /* FUTURE */
return (0);
#else
return (f == FP_NAN);
@@ -2170,7 +2176,7 @@ bool mprIsInfinite(double f)
#if WIN
return !_finite(f);
#elif VXWORKS
- /* FUTURE */
+ /* FUTURE */
return (0);
#else
return (f == FP_INFINITE);
diff --git a/source4/lib/ejs/var.h b/source4/lib/ejs/var.h
index 4882aacf0f..300a0795d8 100644
--- a/source4/lib/ejs/var.h
+++ b/source4/lib/ejs/var.h
@@ -56,7 +56,7 @@
/********************************* Includes ***********************************/
-#include "lib/ejs/miniMpr.h"
+#include "miniMpr.h"
/********************************** Defines ***********************************/
@@ -92,7 +92,7 @@ typedef int MprType;
#define MPR_TYPE_FUNCTION 8 /* JavaScript function */
#define MPR_TYPE_STRING 9 /* String (immutable) */
#define MPR_TYPE_STRING_CFUNCTION 10 /* C/C++ function with string args */
-#define MPR_TYPE_PTR 11 /* C pointer */
+#define MPR_TYPE_PTR 11 /* Opaque pointer */
/*
* Create a type for the default number type
@@ -140,7 +140,7 @@ typedef BLD_FEATURE_NUM_TYPE MprNum;
#define mprVarIsFloating(type) \
(type == MPR_TYPE_FLOAT)
#define mprVarIsPtr(type) \
- (type == MPR_TYPE_PTR)
+ (type == MPR_TYPE_PTR)
#define mprVarIsUndefined(var) \
((var)->type == MPR_TYPE_UNDEFINED)
#define mprVarIsNull(var) \
@@ -252,9 +252,12 @@ typedef struct MprProperties { /* Collection of properties */
#endif
struct MprVar **buckets; /* Hash chains */
int numItems; /* Total count of items */
+ /* FUTURE - Better way of doing this */
int numDataItems; /* Enumerable data items */
uint hashSize : 8; /* Size of the hash table */
+ /* FUTURE -- increase size of refCount */
uint refCount : 8; /* References to this property*/
+ /* FUTURE - make these flags */
uint deleteProtect : 8; /* Don't recursively delete */
uint visited : 8; /* Node has been processed */
} MprProperties;
@@ -263,8 +266,11 @@ typedef struct MprProperties { /* Collection of properties */
* Universal Variable Type
*/
typedef struct MprVar {
+ /* FUTURE - remove name to outside reference */
MprStr name; /* Property name */
+ /* FUTURE - remove */
MprStr fullName; /* Full object name */
+ /* FUTURE - make part of the union */
MprProperties *properties; /* Pointer to properties */
/*
@@ -318,7 +324,7 @@ typedef struct MprVar {
void *thisPtr;
} cFunctionWithStrings;
MprStr string; /* Allocated string */
- void *ptr; /* C pointer */
+ void *ptr; /* Opaque pointer */
#if !BLD_DEBUG && !LINUX && !VXWORKS
};
#endif
@@ -355,7 +361,6 @@ extern MprVar mprCreateObjVar(const char *name, int hashSize);
extern MprVar mprCreateBoolVar(bool value);
extern MprVar mprCreateCFunctionVar(MprCFunction fn, void *thisPtr,
int flags);
-extern MprVar mprCreatePtrVar(void *ptr, const char *name);
#if BLD_FEATURE_FLOATING_POINT
extern MprVar mprCreateFloatVar(double value);
#endif
@@ -370,6 +375,7 @@ extern MprVar mprCreateStringCFunctionVar(MprStringCFunction fn,
void *thisPtr, int flags);
extern MprVar mprCreateStringVar(const char *value, bool allocate);
extern MprVar mprCreateUndefinedVar(void);
+extern MprVar mprCreatePtrVar(void *ptr);
extern bool mprDestroyVar(MprVar *vp);
extern bool mprDestroyAllVars(MprVar* vp);
extern MprType mprGetVarType(MprVar *vp);
@@ -404,9 +410,12 @@ extern int mprDeleteProperty(MprVar *obj, const char *property);
/*
* Get/Set properties. Set will update/create.
*/
-extern MprVar *mprGetProperty(MprVar *obj, const char *property, MprVar *value);
-extern MprVar *mprSetProperty(MprVar *obj, const char *property, MprVar *value);
-extern MprVar *mprSetPropertyValue(MprVar *obj, const char *property, MprVar value);
+extern MprVar *mprGetProperty(MprVar *obj, const char *property,
+ MprVar *value);
+extern MprVar *mprSetProperty(MprVar *obj, const char *property,
+ MprVar *value);
+extern MprVar *mprSetPropertyValue(MprVar *obj, const char *property,
+ MprVar value);
/*
* Directly read/write property values (the property must already exist)
diff --git a/source4/scripting/ejs/ejsrpc.c b/source4/scripting/ejs/ejsrpc.c
index 57e0a8f690..fe61eac502 100644
--- a/source4/scripting/ejs/ejsrpc.c
+++ b/source4/scripting/ejs/ejsrpc.c
@@ -284,7 +284,7 @@ NTSTATUS ejs_push_GUID(struct ejs_rpc *ejs,
NTSTATUS ejs_push_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name)
{
- return mprSetVar(v, name, mprCreatePtrVar(NULL, name));
+ return mprSetVar(v, name, mprCreatePtrVar(NULL));
}
BOOL ejs_pull_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name)
diff --git a/source4/scripting/ejs/mprutil.c b/source4/scripting/ejs/mprutil.c
index 40ca050a96..4f799b2066 100644
--- a/source4/scripting/ejs/mprutil.c
+++ b/source4/scripting/ejs/mprutil.c
@@ -128,7 +128,7 @@ struct MprVar mprList(const char *name, const char **list)
struct MprVar mprString(const char *s)
{
if (s == NULL) {
- return mprCreatePtrVar(NULL, "NULL");
+ return mprCreatePtrVar(NULL);
}
return mprCreateStringVar(s, 1);
}
@@ -289,7 +289,7 @@ struct MprVar mprWERROR(WERROR status)
*/
void mprSetPtr(struct MprVar *v, const char *propname, const void *p)
{
- mprSetVar(v, propname, mprCreatePtrVar(discard_const(p), NULL));
+ mprSetVar(v, propname, mprCreatePtrVar(discard_const(p)));
}
/*
@@ -297,7 +297,7 @@ void mprSetPtr(struct MprVar *v, const char *propname, const void *p)
*/
void mprSetPtrChild(struct MprVar *v, const char *propname, const void *p)
{
- mprSetVar(v, propname, mprCreatePtrVar(discard_const(p), NULL));
+ mprSetVar(v, propname, mprCreatePtrVar(discard_const(p)));
talloc_steal(mprGetProperty(v, propname, NULL), p);
}
diff --git a/source4/scripting/ejs/smbcalls_cli.c b/source4/scripting/ejs/smbcalls_cli.c
index c5611d555d..2433b33352 100644
--- a/source4/scripting/ejs/smbcalls_cli.c
+++ b/source4/scripting/ejs/smbcalls_cli.c
@@ -86,8 +86,7 @@ static int ejs_cli_connect(MprVarHandle eid, int argc, char **argv)
/* Return a socket object */
- mpr_Return(eid, mprCreatePtrVar(transport,
- talloc_get_name(transport)));
+ mpr_Return(eid, mprCreatePtrVar(transport));
return 0;
}
@@ -214,8 +213,7 @@ static int ejs_cli_ssetup(MprVarHandle eid, int argc, MprVar **argv)
/* Return a session object */
- mpr_Return(eid, mprCreatePtrVar(session,
- talloc_get_name(session)));
+ mpr_Return(eid, mprCreatePtrVar(session));
result = 0;
@@ -297,8 +295,7 @@ static int ejs_cli_tree_connect(MprVarHandle eid, int argc, MprVar **argv)
talloc_free(mem_ctx);
- mpr_Return(eid, mprCreatePtrVar(tree,
- talloc_get_name(tree)));
+ mpr_Return(eid, mprCreatePtrVar(tree));
return 0;
}
@@ -446,7 +443,7 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv)
return 0;
}
- mpr_Return(eid, mprCreatePtrVar(tree, talloc_get_name(tree)));
+ mpr_Return(eid, mprCreatePtrVar(tree));
return 0;
}
diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c
index 53f7bc2e55..6aef216ca4 100644
--- a/source4/scripting/ejs/smbcalls_rpc.c
+++ b/source4/scripting/ejs/smbcalls_rpc.c
@@ -412,7 +412,7 @@ void smb_setup_ejs_rpc_constants(int eid)
r->constants(eid);
}
- v = mprCreatePtrVar(NULL, "NULL");
+ v = mprCreatePtrVar(NULL);
mprSetProperty(ejsGetGlobalObject(eid), "NULL", &v);
}