Skip to content

Commit

Permalink
remove unused jspExecuteJSFunction, fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Oct 24, 2024
1 parent 90bd1c3 commit d79b0e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
14 changes: 4 additions & 10 deletions src/jsparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/jsparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d79b0e2

Please sign in to comment.