From d79b0e2d1829a68e59f67a73a19f75685011e9b3 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 24 Oct 2024 14:47:52 +0100 Subject: [PATCH] remove unused jspExecuteJSFunction, fix warnings --- src/jsparse.c | 14 ++++---------- src/jsparse.h | 4 +--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/jsparse.c b/src/jsparse.c index 81277e2fd..a317cd6c6 100644 --- a/src/jsparse.c +++ b/src/jsparse.c @@ -3341,21 +3341,15 @@ JsVar *jspEvaluate(const char *str, bool stringIsStatic) { return v; } -JsVar *jspExecuteJSFunction(const char *jsCode, JsVar *thisArg, int argCount, JsVar **argPtr) { - JsVar *fn = jspEvaluate(jsCode,true); - JsVar *result = jspExecuteFunction(fn,thisArg,argCount,argPtr); - jsvUnLock(fn); - return result; -} - -JsVar *jspExecuteJSFunctionCode(const char *argNames, const char *jsCode, int jsCodeLen, JsVar *thisArg, int argCount, JsVar **argPtr) { +JsVar *jspExecuteJSFunctionCode(const char *argNames, const char *jsCode, size_t jsCodeLen, JsVar *thisArg, int argCount, JsVar **argPtr) { if (jsCodeLen==0) jsCodeLen = strlen(jsCode); JsVar *fn = jsvNewWithFlags(JSV_FUNCTION); if (!fn) return 0; // split `argNames` up and add each name if (argNames && *argNames) { - char name[10], nameLen; - name[0] = 0xFF; + char name[10]; + int nameLen; + name[0] = (char)0xFF; while (*argNames) { const char *argEnd = argNames; nameLen = 1; diff --git a/src/jsparse.h b/src/jsparse.h index 59efc81d3..de92f1b6e 100644 --- a/src/jsparse.h +++ b/src/jsparse.h @@ -70,11 +70,9 @@ JsVar *jspEvaluateVar(JsVar *str, JsVar *scope, uint16_t lineNumberOffset); * the life of the interpreter, as then the interpreter will use a pointer * to this data, which could hang around inside the code. */ JsVar *jspEvaluate(const char *str, bool stringIsStatic); -/// Execute a JS function with the given arguments. usage: jspExecuteJSFunction("(function() { print('hi'); })",0,0,0) -JsVar *jspExecuteJSFunction(const char *jsCode, JsVar *thisArg, int argCount, JsVar **argPtr); /** Execute JS function code with the given arguments. usage: jspExecuteJSFunctionCode("a,b","print('hi',a,b);",0, NULL, 2,&arrayOfJsVar) jsCodeLen is supplied so we can reference code that contains 0 */ -JsVar *jspExecuteJSFunctionCode(const char *argNames, const char *jsCode, int jsCodeLen, JsVar *thisArg, int argCount, JsVar **argPtr); +JsVar *jspExecuteJSFunctionCode(const char *argNames, const char *jsCode, size_t jsCodeLen, JsVar *thisArg, int argCount, JsVar **argPtr); /// Execute a function with the given arguments JsVar *jspExecuteFunction(JsVar *func, JsVar *thisArg, int argCount, JsVar **argPtr);