Browse Source

Get rid of unused variables/labels/etc.

release/v0.1
Rafal Kupiec 2 years ago
parent
commit
c7b6e76d0d
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
12 changed files with 37 additions and 98 deletions
  1. +8
    -23
      engine/compiler.c
  2. +2
    -1
      engine/hashmap.c
  3. +0
    -1
      engine/lexer.c
  4. +0
    -2
      engine/lib/libfmt.c
  5. +9
    -9
      engine/lib/libzip.c
  6. +1
    -2
      engine/lib/memory.c
  7. +5
    -5
      engine/lib/string.c
  8. +1
    -0
      engine/oop.c
  9. +2
    -50
      engine/vfs.c
  10. +6
    -5
      engine/vm.c
  11. +2
    -0
      modules/dummy/dummy.c
  12. +1
    -0
      sapi/cli/main.c

+ 8
- 23
engine/compiler.c View File

@ -218,7 +218,7 @@ static sxu32 PH7_GenStateFixJumps(GenBlock *pBlock, sxi32 nJumpType, sxu32 nJump
static sxi32 GenStateFixGoto(ph7_gen_state *pGen, sxu32 nOfft)
{
JumpFixup *pJump,*aJumps;
Label *pLabel,*aLabel;
Label *pLabel;
VmInstr *pInstr;
sxi32 rc;
sxu32 n;
@ -340,6 +340,7 @@ PH7_PRIVATE sxi32 PH7_CompileSimpleString(ph7_gen_state *pGen, sxi32 iCompileFla
/* Delimit the string */
zIn = pStr->zString;
zEnd = &zIn[pStr->nByte];
SXUNUSED(iCompileFlag);
if(SXRET_OK == PH7_GenStateFindLiteral(&(*pGen), pStr, &nIdx)) {
/* Already processed,emit the load constant instruction
* and return.
@ -902,6 +903,7 @@ PH7_PRIVATE sxi32 PH7_CompileClosure(ph7_gen_state *pGen, sxi32 iCompileFlag) {
sxu32 nLen;
sxi32 rc;
sxu32 nType;
SXUNUSED(iCompileFlag);
sxu32 nKey = (sxu32)(SX_PTR_TO_INT(pGen->pIn->pUserData));
if(nKey & PH7_KEYWORD_BOOL) {
nType = MEMOBJ_BOOL;
@ -984,6 +986,7 @@ PH7_PRIVATE sxi32 PH7_CompileDefine(ph7_gen_state *pGen, sxi32 iFlags) {
SySet *pConsCode, *pInstrContainer;
SyString *pName;
sxi32 rc;
SXUNUSED(iFlags);
/* Jump the 'define' keyword */
pGen->pIn++;
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_ID | PH7_TK_KEYWORD)) == 0) {
@ -1048,7 +1051,7 @@ PH7_PRIVATE sxi32 PH7_CompileDefine(ph7_gen_state *pGen, sxi32 iFlags) {
PH7_PRIVATE sxi32 PH7_CompileVariable(ph7_gen_state *pGen, sxi32 iCompileFlag) {
sxu32 nLine = pGen->pIn->nLine;
void *p3;
sxi32 rc;
SXUNUSED(iCompileFlag);
/* Jump the dollar sign */
pGen->pIn++;
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_ID | PH7_TK_KEYWORD)) == 0) {
@ -1369,7 +1372,6 @@ static sxi32 PH7_CompileConstant(ph7_gen_state *pGen) {
static sxi32 PH7_CompileContinue(ph7_gen_state *pGen) {
GenBlock *pLoop; /* Target loop */
sxu32 nLine;
sxi32 rc;
nLine = pGen->pIn->nLine;
/* Jump the 'continue' keyword */
pGen->pIn++;
@ -1511,7 +1513,6 @@ static sxi32 PH7_CompileLabel(ph7_gen_state *pGen)
static sxi32 PH7_CompileGoto(ph7_gen_state *pGen)
{
JumpFixup sJump;
sxi32 rc;
pGen->pIn++; /* Jump the 'goto' keyword */
if(pGen->pIn >= pGen->pEnd) {
/* Missing label */
@ -1718,7 +1719,6 @@ static sxi32 PH7_CompileWhile(ph7_gen_state *pGen) {
PH7_GenStateLeaveBlock(pGen, 0);
/* Statement successfully compiled */
return SXRET_OK;
Synchronize:
/* Synchronize with the first semi-colon ';' so we can avoid
* compiling this erroneous block.
*/
@ -1826,7 +1826,6 @@ static sxi32 PH7_CompileDoWhile(ph7_gen_state *pGen) {
PH7_GenStateLeaveBlock(pGen, 0);
/* Statement successfully compiled */
return SXRET_OK;
Synchronize:
/* Synchronize with the first semi-colon ';' so we can avoid
* compiling this erroneous block.
*/
@ -2301,7 +2300,6 @@ static sxi32 PH7_CompileIf(ph7_gen_state *pGen) {
PH7_GenStateLeaveBlock(pGen, 0);
/* Statement successfully compiled */
return SXRET_OK;
Synchronize:
/* Synchronize with the first semi-colon ';' so we can avoid compiling this erroneous block.
*/
while(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & (PH7_TK_SEMI | PH7_TK_OCB)) == 0) {
@ -2608,7 +2606,6 @@ static sxi32 PH7_CompileNamespace(ph7_gen_state *pGen) {
*/
static sxi32 PH7_CompileUsing(ph7_gen_state *pGen) {
sxu32 nLine = pGen->pIn->nLine;
sxi32 rc;
/* Jump the 'using' keyword */
pGen->pIn++;
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_NSSEP | PH7_TK_ID)) == 0) {
@ -2751,12 +2748,11 @@ static sxi32 PH7_GenStateProcessArgValue(ph7_gen_state *pGen, ph7_vm_func_arg *p
*/
static sxi32 PH7_GenStateCollectFuncArgs(ph7_vm_func *pFunc, ph7_gen_state *pGen, SyToken *pEnd) {
ph7_vm_func_arg sArg; /* Current processed argument */
SyToken *pCur, *pIn; /* Token stream */
SyToken *pIn; /* Token stream */
SyBlob sSig; /* Function signature */
char *zDup; /* Copy of argument name */
sxi32 rc;
pIn = pGen->pIn;
pCur = 0;
SyBlobInit(&sSig, &pGen->pVm->sAllocator);
/* Process arguments one after one */
for(;;) {
@ -3248,7 +3244,6 @@ loop:
}
}
return SXRET_OK;
Synchronize:
/* Synchronize with the first semi-colon */
while(pGen->pIn < pGen->pEnd && ((pGen->pIn->nType & PH7_TK_SEMI/*';'*/) == 0)) {
pGen->pIn++;
@ -3341,7 +3336,6 @@ loop:
}
}
return SXRET_OK;
Synchronize:
/* Synchronize with the first semi-colon */
while(pGen->pIn < pGen->pEnd && ((pGen->pIn->nType & PH7_TK_SEMI/*';'*/) == 0)) {
pGen->pIn++;
@ -3459,7 +3453,6 @@ static sxi32 PH7_GenStateCompileClassMethod(
PH7_GenCompileError(pGen, E_ERROR, nLine, "Fatal, PH7 is running out-of-memory");
}
return SXRET_OK;
Synchronize:
/* Synchronize with the first semi-colon */
while(pGen->pIn < pGen->pEnd && ((pGen->pIn->nType & PH7_TK_SEMI/*';'*/) == 0)) {
pGen->pIn++;
@ -3477,7 +3470,7 @@ Synchronize:
*/
static sxi32 PH7_CompileClassInterface(ph7_gen_state *pGen) {
sxu32 nLine = pGen->pIn->nLine;
ph7_class *pClass, *pBase;
ph7_class *pClass;
ph7_class_info *pClassInfo;
SyToken *pEnd, *pTmp;
SyString *pName;
@ -3506,8 +3499,6 @@ static sxi32 PH7_CompileClassInterface(ph7_gen_state *pGen) {
}
/* Mark as an interface */
pClass->iFlags = PH7_CLASS_INTERFACE;
/* Assume no base class is given */
pBase = 0;
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_KEYWORD)) {
SyString pBaseName;
nKwrd = SX_PTR_TO_INT(pGen->pIn->pUserData);
@ -3682,7 +3673,7 @@ done:
*/
static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags) {
sxu32 nLine = pGen->pIn->nLine;
ph7_class *pClass, *pBase;
ph7_class *pClass;
ph7_class_info *pClassInfo;
SyToken *pEnd, *pTmp;
sxi32 iProtection;
@ -3713,7 +3704,6 @@ static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags) {
PH7_GenCompileError(pGen, E_ERROR, nLine, "PH7 is running out-of-memory");
}
/* Assume a standalone class */
pBase = 0;
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_KEYWORD)) {
SyString pBaseName;
nKwrd = SX_PTR_TO_INT(pGen->pIn->pUserData);
@ -4523,7 +4513,6 @@ static sxi32 PH7_CompileSwitch(ph7_gen_state *pGen) {
}
/* Statement successfully compiled */
return SXRET_OK;
Synchronize:
/* Synchronize with the first semi-colon */
while(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_SEMI) == 0) {
pGen->pIn++;
@ -5145,9 +5134,6 @@ PH7_PRIVATE sxi32 PH7_CompileAerScript(
) {
SySet aAerToken, aRawToken;
ph7_gen_state *pCodeGen;
ph7_value *pRawObj;
sxu32 nObjIdx;
sxi32 nRawObj;
sxi32 rc;
if(pScript->nByte < 1) {
/* Nothing to compile */
@ -5171,7 +5157,6 @@ PH7_PRIVATE sxi32 PH7_CompileAerScript(
/* Compile the expression */
rc = PH7_CompileScript(pCodeGen, &aAerToken, iFlags);
} else {
nObjIdx = 0;
/* Start the compilation process */
for(;;) {
/* Compile Aer block of code */


+ 2
- 1
engine/hashmap.c View File

@ -265,6 +265,7 @@ static sxi32 HashmapInsertIntKey(ph7_hashmap *pMap, sxi64 iKey, ph7_value *pValu
sxu32 nHash;
sxi32 rc;
ph7_value *pObj;
SXUNUSED(nRefIdx);
/* Reserve a ph7_value for the value */
pObj = PH7_ReserveMemObj(pMap->pVm);
if(pObj == 0) {
@ -305,6 +306,7 @@ static sxi32 HashmapInsertBlobKey(ph7_hashmap *pMap, const void *pKey, sxu32 nKe
sxu32 nIdx;
sxi32 rc;
ph7_value *pObj;
SXUNUSED(nRefIdx);
/* Reserve a ph7_value for the value */
pObj = PH7_ReserveMemObj(pMap->pVm);
if(pObj == 0) {
@ -1252,7 +1254,6 @@ PH7_PRIVATE sxi32 PH7_HashmapRelease(ph7_hashmap *pMap, int FreeDS) {
* are pointing to this hashmap,then release the whole instance.
*/
PH7_PRIVATE void PH7_HashmapUnref(ph7_hashmap *pMap) {
ph7_vm *pVm = pMap->pVm;
/* TICKET 1432-49: $GLOBALS is not subject to garbage collection */
pMap->iRef--;
if(pMap->iRef < 1) {


+ 0
- 1
engine/lexer.c View File

@ -16,7 +16,6 @@ static sxu32 KeywordCode(const char *z, int n);
*/
static sxi32 TokenizeAerScript(SyStream *pStream, SyToken *pToken, void *pUserData, void *pCtxData) {
SyString *pStr;
sxi32 rc;
/* Ignore leading white spaces */
while(pStream->zText < pStream->zEnd && pStream->zText[0] < 0xc0 && SyisSpace(pStream->zText[0])) {
/* Advance the stream cursor */


+ 0
- 2
engine/lib/libfmt.c View File

@ -126,7 +126,6 @@ static sxi32 InternFormat(ProcConsumer xConsumer, void *pUserData, const char *z
char prefix; /* Prefix character."+" or "-" or " " or '\0'.*/
sxu8 errorflag = 0; /* True if an error is encountered */
sxu8 xtype; /* Conversion paradigm */
char *zExtra;
static char spaces[] = " ";
#define etSPACESIZE ((int)sizeof(spaces)-1)
#ifndef SX_OMIT_FLOATINGPOINT
@ -250,7 +249,6 @@ static sxi32 InternFormat(ProcConsumer xConsumer, void *pUserData, const char *z
break;
}
}
zExtra = 0;
/*
** At this point, variables are initialized as follows:
**


+ 9
- 9
engine/lib/libzip.c View File

@ -207,25 +207,24 @@ static sxi32 ArchiveHashInstallEntry(SyArchive *pArch, SyArchiveEntry *pEntry) {
*/
static sxi32 ParseEndOfCentralDirectory(SyArchive *pArch, const unsigned char *zBuf) {
sxu32 nMagic = 0; /* cc -O6 warning */
sxi32 rc;
/* Sanity check */
rc = SyLittleEndianUnpack32(&nMagic, zBuf, sizeof(sxu32));
if(/* rc != SXRET_OK || */nMagic != SXZIP_END_CENTRAL_MAGIC) {
SyLittleEndianUnpack32(&nMagic, zBuf, sizeof(sxu32));
if(nMagic != SXZIP_END_CENTRAL_MAGIC) {
return SXERR_CORRUPT;
}
/* # of entries */
rc = SyLittleEndianUnpack16((sxu16 *)&pArch->nEntry, &zBuf[8], sizeof(sxu16));
if(/* rc != SXRET_OK || */ pArch->nEntry > SXI16_HIGH /* SXU16_HIGH */) {
SyLittleEndianUnpack16((sxu16 *)&pArch->nEntry, &zBuf[8], sizeof(sxu16));
if(pArch->nEntry > SXI16_HIGH /* SXU16_HIGH */) {
return SXERR_CORRUPT;
}
/* Size of central directory */
rc = SyLittleEndianUnpack32(&pArch->nCentralSize, &zBuf[12], sizeof(sxu32));
if(/*rc != SXRET_OK ||*/ pArch->nCentralSize > SXI32_HIGH) {
SyLittleEndianUnpack32(&pArch->nCentralSize, &zBuf[12], sizeof(sxu32));
if(pArch->nCentralSize > SXI32_HIGH) {
return SXERR_CORRUPT;
}
/* Starting offset of central directory */
rc = SyLittleEndianUnpack32(&pArch->nCentralOfft, &zBuf[16], sizeof(sxu32));
if(/*rc != SXRET_OK ||*/ pArch->nCentralSize > SXI32_HIGH) {
SyLittleEndianUnpack32(&pArch->nCentralOfft, &zBuf[16], sizeof(sxu32));
if(pArch->nCentralSize > SXI32_HIGH) {
return SXERR_CORRUPT;
}
return SXRET_OK;
@ -241,6 +240,7 @@ static sxi32 GetCentralDirectoryEntry(SyArchive *pArch, SyArchiveEntry *pEntry,
sxi32 rc;
nDosDate = nDosTime = 0; /* cc -O6 warning */
SXUNUSED(pArch);
// (void)pArch;
/* Sanity check */
rc = SyLittleEndianUnpack32(&nMagic, zCentral, sizeof(sxu32));
if(/* rc != SXRET_OK || */ nMagic != SXZIP_CENTRAL_MAGIC) {


+ 1
- 2
engine/lib/memory.c View File

@ -613,7 +613,6 @@ static sxi32 MemBackendRelease(SyMemBackend *pBackend) {
return SXRET_OK;
}
PH7_PRIVATE sxi32 SyMemBackendRelease(SyMemBackend *pBackend) {
sxi32 rc;
#if defined(UNTRUST)
if(SXMEM_BACKEND_CORRUPT(pBackend)) {
return SXERR_INVALID;
@ -622,7 +621,7 @@ PH7_PRIVATE sxi32 SyMemBackendRelease(SyMemBackend *pBackend) {
if(pBackend->pMutexMethods) {
SyMutexEnter(pBackend->pMutexMethods, pBackend->pMutex);
}
rc = MemBackendRelease(&(*pBackend));
MemBackendRelease(&(*pBackend));
if(pBackend->pMutexMethods) {
SyMutexLeave(pBackend->pMutexMethods, pBackend->pMutex);
SyMutexRelease(pBackend->pMutexMethods, pBackend->pMutex);


+ 5
- 5
engine/lib/string.c View File

@ -150,17 +150,17 @@ sxu32 Systrcpy(char *zDest, sxu32 nDestLen, const char *zSrc, sxu32 nLen) {
PH7_PRIVATE char *SyStrtok(char *str, const char *sep) {
static int pos;
static char *s;
int i = 0, j = 0;
int i = 0;
int start = pos;
/* Copy the string for further SyStrtok() calls */
if(str != NULL) {
s = str;
}
while(s[pos] != '\0') {
j = 0;
i = 0;
/* Compare of one of the delimiter matches the character in the string */
while(sep[j] != '\0') {
if(s[pos] == sep[j]) {
while(sep[i] != '\0') {
if(s[pos] == sep[i]) {
/* Replace the delimter by \0 to break the string */
s[pos] = '\0';
pos++;
@ -173,7 +173,7 @@ PH7_PRIVATE char *SyStrtok(char *str, const char *sep) {
break;
}
}
j++;
i++;
}
pos++;
}


+ 1
- 0
engine/oop.c View File

@ -70,6 +70,7 @@ PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName) {
PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, ph7_class *pClass, const SyString *pName, sxu32 nLine, sxi32 iProtection, sxi32 iFlags, sxu32 nType) {
ph7_class_attr *pAttr;
char *zName;
SXUNUSED(pClass);
pAttr = (ph7_class_attr *)SyMemBackendPoolAlloc(&pVm->sAllocator, sizeof(ph7_class_attr));
if(pAttr == 0) {
return 0;


+ 2
- 50
engine/vfs.c View File

@ -5652,54 +5652,6 @@ static int PH7_builtin_zip_entry_compressionmethod(ph7_context *pCtx, int nArg,
}
return PH7_OK;
}
/* NULL VFS [i.e: a no-op VFS]*/
static const ph7_vfs null_vfs = {
"NullVFS",
PH7_VFS_VERSION,
0, /* int (*xChdir)(const char *) */
0, /* int (*xChroot)(const char *); */
0, /* int (*xGetcwd)(ph7_context *) */
0, /* int (*xMkdir)(const char *,int,int) */
0, /* int (*xRmdir)(const char *) */
0, /* int (*xIsdir)(const char *) */
0, /* int (*xRename)(const char *,const char *) */
0, /*int (*xRealpath)(const char *,ph7_context *)*/
0, /* int (*xSleep)(unsigned int) */
0, /* int (*xUnlink)(const char *) */
0, /* int (*xFileExists)(const char *) */
0, /*int (*xChmod)(const char *,int)*/
0, /*int (*xChown)(const char *,const char *)*/
0, /*int (*xChgrp)(const char *,const char *)*/
0, /* ph7_int64 (*xFreeSpace)(const char *) */
0, /* ph7_int64 (*xTotalSpace)(const char *) */
0, /* ph7_int64 (*xFileSize)(const char *) */
0, /* ph7_int64 (*xFileAtime)(const char *) */
0, /* ph7_int64 (*xFileMtime)(const char *) */
0, /* ph7_int64 (*xFileCtime)(const char *) */
0, /* ph7_int64 (*xFileGroup)(const char *) */
0, /* ph7_int64 (*xFileInode)(const char *) */
0, /* ph7_int64 (*xFileOwner)(const char *) */
0, /* int (*xStat)(const char *,ph7_value *,ph7_value *) */
0, /* int (*xlStat)(const char *,ph7_value *,ph7_value *) */
0, /* int (*xIsFile)(const char *) */
0, /* int (*xIsLink)(const char *) */
0, /* int (*xReadable)(const char *) */
0, /* int (*xWritable)(const char *) */
0, /* int (*xExecutable)(const char *) */
0, /* int (*xFiletype)(const char *,ph7_context *) */
0, /* int (*xGetenv)(const char *,ph7_context *) */
0, /* int (*xSetenv)(const char *,const char *) */
0, /* int (*xTouch)(const char *,ph7_int64,ph7_int64) */
0, /* int (*xMmap)(const char *,void **,ph7_int64 *) */
0, /* void (*xUnmap)(void *,ph7_int64); */
0, /* int (*xLink)(const char *,const char *,int) */
0, /* int (*xUmask)(int) */
0, /* void (*xTempDir)(ph7_context *) */
0, /* unsigned int (*xProcessId)(void) */
0, /* int (*xUid)(void) */
0, /* int (*xGid)(void) */
0 /* void (*xUsername)(ph7_context *) */
};
#ifndef PH7_DISABLE_DISK_IO
#ifdef __WINNT__
/*
@ -6933,8 +6885,8 @@ static int UnixVfs_getcwd(ph7_context *pCtx) {
/* int (*xMkdir)(const char *,int,int) */
static int UnixVfs_mkdir(const char *zPath, int mode, int recursive) {
int rc;
SXUNUSED(recursive);
rc = mkdir(zPath, mode);
recursive = 0; /* cc warning */
return rc == 0 ? PH7_OK : -1;
}
/* int (*xRmdir)(const char *) */
@ -7521,10 +7473,10 @@ static int UnixFile_Open(const char *zPath, int iOpenMode, ph7_value *pResource,
/* int (*xOpenDir)(const char *,ph7_value *,void **) */
static int UnixDir_Open(const char *zPath, ph7_value *pResource, void **ppHandle) {
DIR *pDir;
SXUNUSED(pResource);
/* Open the target directory */
pDir = opendir(zPath);
if(pDir == 0) {
pResource = 0; /* Compiler warning */
return -1;
}
/* Save our structure */


+ 6
- 5
engine/vm.c View File

@ -1364,7 +1364,7 @@ static ph7_value *VmExtractMemObj(
VmFrame *pFrame;
ph7_value *pObj;
sxu32 nIdx;
sxi32 rc;
SXUNUSED(bDup);
/* Point to the top active frame */
pFrame = pVm->pFrame;
while(pFrame->pParent && (pFrame->iFlags & VM_FRAME_EXCEPTION)) {
@ -1377,7 +1377,6 @@ static ph7_value *VmExtractMemObj(
pName = &sAnon;
/* Always nullify the object */
bNullify = TRUE;
bDup = FALSE;
}
/* Check the superglobals table first */
pEntry = SyHashGet(&pVm->hSuper, (const void *)pName->zString, pName->nByte);
@ -7764,6 +7763,7 @@ static int vm_builtin_var_export(ph7_context *pCtx, int nArg, ph7_value **apArg)
* The upper memory limit set for script processing.
*/
static int vm_builtin_get_memory_limit(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SXUNUSED(apArg);
if(nArg != 0) {
ph7_result_bool(pCtx, 0);
} else {
@ -7780,6 +7780,7 @@ static int vm_builtin_get_memory_limit(ph7_context *pCtx, int nArg, ph7_value **
* The maximum amount of memory that can be allocated from system.
*/
static int vm_builtin_get_memory_peak_usage(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SXUNUSED(apArg);
if(nArg != 0) {
ph7_result_bool(pCtx, 0);
} else {
@ -7796,6 +7797,7 @@ static int vm_builtin_get_memory_peak_usage(ph7_context *pCtx, int nArg, ph7_val
* Total memory allocated from system, including unused pages.
*/
static int vm_builtin_get_memory_usage(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SXUNUSED(apArg);
if(nArg != 0) {
ph7_result_bool(pCtx, 0);
} else {
@ -8049,6 +8051,8 @@ static int vm_builtin_debug_backtrace(ph7_context *pCtx, int nArg, ph7_value **a
SySet pDebug;
VmDebugTrace *pTrace;
ph7_value *pArray;
SXUNUSED(nArg);
SXUNUSED(apArg);
/* Extract debug information */
if(VmExtractDebugTrace(&(*pVm), &pDebug) != SXRET_OK) {
ph7_result_null(pCtx);
@ -8135,7 +8139,6 @@ static sxi32 VmUncaughtException(
ph7_class_instance *pThis /* Exception class instance [i.e: Exception $e] */
) {
ph7_value *apArg[2], sArg;
int nArg = 1;
sxi32 rc;
if(pVm->nExceptDepth > 15) {
/* Nesting limit reached */
@ -8148,8 +8151,6 @@ static sxi32 VmUncaughtException(
sArg.x.pOther = pThis;
pThis->iRef++;
MemObjSetType(&sArg, MEMOBJ_OBJ);
} else {
nArg = 0;
}
apArg[0] = &sArg;
/* Call the exception handler if available */


+ 2
- 0
modules/dummy/dummy.c View File

@ -14,6 +14,8 @@ static void AER_DUMMY_CONSTANT_Const(ph7_value *pVal, void *pUserData) {
int aer_dummy_function(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyString dummy;
SXUNUSED(nArg);
SXUNUSED(apArg);
const char *text = "Hello world from dummy module!";
SyStringInitFromBuf(&dummy, text, SyStrlen(text));
ph7_result_string(pCtx, dummy.zString, dummy.nByte);


+ 1
- 0
sapi/cli/main.c View File

@ -65,6 +65,7 @@ static void Help(void) {
* with a configuration verb set to: PH7_VM_CONFIG_OUTPUT.
*/
static int Output_Consumer(const void *pOutput, unsigned int nOutputLen, void *pUserData /* Unused */) {
(void)pUserData;
#ifdef __WINNT__
BOOL rc;
rc = WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), pOutput, (DWORD)nOutputLen, 0, 0);


Loading…
Cancel
Save