Make native class registration use const templates with stack copies, tighten System argument validation and drop unused json_rc
Build / AerScript (push) Successful in 45s

This commit is contained in:
2026-11-24 15:44:06 +01:00
parent 1db842fe0f
commit 0802b294b4
12 changed files with 311 additions and 108 deletions
+4 -4
View File
@@ -2510,8 +2510,6 @@ PH7_PRIVATE sxi32 PH7_VmInit(
PH7_MemObjInit(pVm, &pVm->sPendingTransfer);
/* Default assertion flags */
pVm->iAssertFlags = PH7_ASSERT_WARNING; /* Issue a warning for each failed assertion */
/* JSON return status */
pVm->json_rc = JSON_ERROR_NONE;
/* PRNG context */
SyRandomnessInit(&pVm->sPrng, 0, 0);
/* Install the null constant */
@@ -2711,7 +2709,9 @@ PH7_PRIVATE sxi32 PH7_VmMakeReady(
/* Zero the reference table */
SyZero(pVm->apRefObj, sizeof(VmRefObj *) * pVm->nRefSize);
}
/* Register special functions first [i.e: print, json_encode(), func_get_args(), etc.] */
/* Register special functions first [i.e: module_loaded(), function_exists(),
* class_exists(), get_class(), rand(), var_dump(), print_r(), get_include_path(),
* debug_backtrace(), ...] */
rc = VmRegisterSpecialFunction(&(*pVm));
if(rc != SXRET_OK) {
/* Don't worry about freeing memory, everything will be released shortly */
@@ -3670,7 +3670,7 @@ PH7_PRIVATE sxi32 PH7_VmConfigure(
n = (sxu32)SyStrlen(zValue);
nText = SyBlobLength(&pVm->sArgv);
nEntries = SyBlobLength(&pVm->sArgvEntries);
/* Keep exact entries separately from getopt's legacy flat text. */
/* Keep exact argument entries separately from the flat $argv text. */
rc = SyBlobAppend(&pVm->sArgvEntries, zValue, n + 1);
if(rc == SXRET_OK && n > 0) {
if(nText > 0) {