1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 07:43:50 +00:00

1. Updated to duktape 2.6.0

2. Added support for execution timeout
This commit is contained in:
Bryan Roe
2021-02-16 15:10:28 -08:00
parent 9d2fe9b2b0
commit 71b5e588c3
8 changed files with 11670 additions and 8367 deletions

View File

@@ -1584,19 +1584,19 @@ void *ILibDuktape_ScriptContainer_Engine_realloc(void *udata, void *ptr, duk_siz
difference = size - ILibMemory_Size(ptr);
ILibDuktape_ScriptContainer_TotalAllocations += difference;
}
if (size == 0)
{
ILibMemory_Free(ptr);
ptr = NULL;
}
else
//if (size == 0)
//{
// ILibMemory_Free(ptr);
// ptr = NULL;
//}
//else
{
ptr = ILibMemory_SmartReAllocate(ptr, size);
}
}
else
{
if (size > 0)
//if (size > 0)
{
ptr = ILibMemory_SmartAllocateEx(size, sizeof(void*));
((void**)ILibMemory_Extra(ptr))[0] = udata;
@@ -1604,6 +1604,10 @@ void *ILibDuktape_ScriptContainer_Engine_realloc(void *udata, void *ptr, duk_siz
}
}
if (ptr == NULL)
{
printf("PTR WAS NULL!\n");
}
return(ptr);
}
void ILibDuktape_ScriptContainer_Engine_free(void *udata, void *ptr)
@@ -2573,6 +2577,13 @@ duk_context *ILibDuktape_ScriptContainer_InitializeJavaScriptEngine_minimal()
#endif
ctxd->threads = ILibLinkedList_Create();
#ifdef DUKTAPE_EXECUTION_MAXTIMEOUT
ctxd->maxExecutionTime = DUKTAPE_EXECUTION_MAXTIMEOUT;
#else
ctxd->maxExecutionTime = DUKTAPE_DEFAULT_MAX_EXECUTION_TIMEOUT;
#endif
duk_context *ctx = duk_create_heap(ILibDuktape_ScriptContainer_Engine_malloc, ILibDuktape_ScriptContainer_Engine_realloc, ILibDuktape_ScriptContainer_Engine_free, ctxd, ILibDuktape_ScriptContainer_Engine_fatal);
if (ctx == NULL) { ILIBCRITICALEXIT(254); }
return(ctx);