Update code formatting.
All checks were successful
The build was successful.

This commit is contained in:
2019-11-18 18:57:10 +01:00
parent d3479a6e80
commit e1e6a19f30
11 changed files with 414 additions and 414 deletions

View File

@@ -879,7 +879,7 @@ const char *ph7_value_to_string(ph7_value *pValue, int *pLen) {
*/
void *ph7_value_to_resource(ph7_value *pValue) {
if((pValue->nType & MEMOBJ_RES) == 0) {
/* Not a resource,return NULL */
/* Not a resource, return NULL */
return 0;
}
return pValue->x.pOther;

View File

@@ -220,7 +220,7 @@ static int PH7_builtin_round(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int n = 0;
double r;
if(nArg < 1) {
/* Missing argument,return 0 */
/* Missing argument, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -266,7 +266,7 @@ static int PH7_builtin_round(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int PH7_builtin_dechex(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int iVal;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -288,7 +288,7 @@ static int PH7_builtin_dechex(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int PH7_builtin_decoct(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int iVal;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -310,7 +310,7 @@ static int PH7_builtin_decoct(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int PH7_builtin_decbin(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int iVal;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -334,7 +334,7 @@ static int PH7_builtin_hexdec(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_int64 iVal;
int nLen;
if(nArg < 1) {
/* Missing arguments,return -1 */
/* Missing arguments, return -1 */
ph7_result_int(pCtx, -1);
return PH7_OK;
}
@@ -386,7 +386,7 @@ static int PH7_builtin_bindec(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_int64 iVal;
int nLen;
if(nArg < 1) {
/* Missing arguments,return -1 */
/* Missing arguments, return -1 */
ph7_result_int(pCtx, -1);
return PH7_OK;
}
@@ -420,7 +420,7 @@ static int PH7_builtin_octdec(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_int64 iVal;
int nLen;
if(nArg < 1) {
/* Missing arguments,return -1 */
/* Missing arguments, return -1 */
ph7_result_int(pCtx, -1);
return PH7_OK;
}
@@ -579,7 +579,7 @@ static int PH7_builtin_substr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Extract the target string */
zSource = ph7_value_to_string(apArg[0], &nSrcLen);
if(nSrcLen < 1) {
/* Empty string,return FALSE */
/* Empty string, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -607,7 +607,7 @@ static int PH7_builtin_substr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Extract the length */
nLen = ph7_value_to_int(apArg[2]);
if(nLen == 0) {
/* Invalid length,return an empty string */
/* Invalid length, return an empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
} else if(nLen < 0) {
@@ -653,14 +653,14 @@ static int PH7_builtin_substr_compare(ph7_context *pCtx, int nArg, ph7_value **a
int iCase = 0;
int rc;
if(nArg < 3) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Extract the target string */
zSource = ph7_value_to_string(apArg[0], &nSrcLen);
if(nSrcLen < 1) {
/* Empty string,return FALSE */
/* Empty string, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -668,7 +668,7 @@ static int PH7_builtin_substr_compare(ph7_context *pCtx, int nArg, ph7_value **a
/* Extract the substring */
zSub = ph7_value_to_string(apArg[1], &nSublen);
if(nSublen < 1 || nSublen > nSrcLen) {
/* Empty string,return FALSE */
/* Empty string, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -749,7 +749,7 @@ static int PH7_builtin_substr_count(ph7_context *pCtx, int nArg, ph7_value **apA
/* Point to the neddle */
zPattern = ph7_value_to_string(apArg[1], &nPatlen);
if(nTextlen < 1 || nPatlen < 1 || nPatlen > nTextlen) {
/* NOOP,return zero */
/* NOOP, return zero */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -758,7 +758,7 @@ static int PH7_builtin_substr_count(ph7_context *pCtx, int nArg, ph7_value **apA
/* Extract the offset */
nOfft = ph7_value_to_int(apArg[2]);
if(nOfft < 0 || nOfft > nTextlen) {
/* Invalid offset,return zero */
/* Invalid offset, return zero */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -774,7 +774,7 @@ static int PH7_builtin_substr_count(ph7_context *pCtx, int nArg, ph7_value **apA
/* Extract the length */
nLen = ph7_value_to_int(apArg[3]);
if(nLen < 0 || nLen > nTextlen) {
/* Invalid length,return 0 */
/* Invalid length, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -817,7 +817,7 @@ static int PH7_builtin_chunk_split(ph7_context *pCtx, int nArg, ph7_value **apAr
const char *zIn, *zEnd, *zSep = "\r\n";
int nSepLen, nChunkLen, nLen;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Nothing to split,return null */
/* Nothing to split, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -845,7 +845,7 @@ static int PH7_builtin_chunk_split(ph7_context *pCtx, int nArg, ph7_value **apAr
}
/* Perform the requested operation */
if(nChunkLen > nLen) {
/* Nothing to split,return the string and the separator */
/* Nothing to split, return the string and the separator */
ph7_result_string_format(pCtx, "%.*s%.*s", nLen, zIn, nSepLen, zSep);
return PH7_OK;
}
@@ -917,7 +917,7 @@ static int cSlashCheckMask(int c, const char *zMask, int nLen) {
const char *zEnd = &zMask[nLen];
while(zMask < zEnd) {
if(zMask[0] == c) {
/* Character present,return TRUE */
/* Character present, return TRUE */
return 1;
}
/* Advance the pointer */
@@ -1116,7 +1116,7 @@ static int PH7_builtin_htmlspecialchars(ph7_context *pCtx, int nArg, ph7_value *
int iFlags = 0x01 | 0x40; /* ENT_COMPAT | ENT_HTML401 */
int nLen, c;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -1197,7 +1197,7 @@ static int PH7_builtin_htmlspecialchars_decode(ph7_context *pCtx, int nArg, ph7_
int iFlags = 0x01; /* ENT_COMPAT */
int nLen, nJump;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -1338,7 +1338,7 @@ static int PH7_builtin_htmlentities(ph7_context *pCtx, int nArg, ph7_value **apA
int nLen, c;
sxu32 n;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -1402,7 +1402,7 @@ static int PH7_builtin_html_entity_decode(ph7_context *pCtx, int nArg, ph7_value
int nLen;
sxu32 n;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -1673,7 +1673,7 @@ static int PH7_builtin_implode(ph7_context *pCtx, int nArg, ph7_value **apArg) {
struct implode_data imp_data;
int i = 1;
if(nArg < 1) {
/* Missing argument,return NULL */
/* Missing argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -1737,7 +1737,7 @@ static int PH7_builtin_implode_recursive(ph7_context *pCtx, int nArg, ph7_value
struct implode_data imp_data;
int i = 1;
if(nArg < 1) {
/* Missing argument,return NULL */
/* Missing argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -1812,21 +1812,21 @@ static int PH7_builtin_explode(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nOfft;
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Extract the delimiter */
zDelim = ph7_value_to_string(apArg[0], &nDelim);
if(nDelim < 1) {
/* Empty delimiter,return FALSE */
/* Empty delimiter, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Extract the string */
zString = ph7_value_to_string(apArg[1], &nStrlen);
if(nStrlen < 1) {
/* Empty delimiter,return FALSE */
/* Empty delimiter, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1836,7 +1836,7 @@ static int PH7_builtin_explode(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pArray = ph7_context_new_array(pCtx);
pValue = ph7_context_new_scalar(pCtx);
if(pArray == 0 || pValue == 0) {
/* Out of memory,return FALSE */
/* Out of memory, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1905,14 +1905,14 @@ static int PH7_builtin_trim(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zString;
int nLen;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return */
/* Empty string, return */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -1998,14 +1998,14 @@ static int PH7_builtin_rtrim(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zString;
int nLen;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return */
/* Empty string, return */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -2074,14 +2074,14 @@ static int PH7_builtin_ltrim(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zString;
int nLen;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return */
/* Empty string, return */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -2144,14 +2144,14 @@ static int PH7_builtin_strtolower(ph7_context *pCtx, int nArg, ph7_value **apArg
const char *zString, *zCur, *zEnd;
int nLen;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return */
/* Empty string, return */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -2197,14 +2197,14 @@ static int PH7_builtin_strtoupper(ph7_context *pCtx, int nArg, ph7_value **apArg
const char *zString, *zCur, *zEnd;
int nLen;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return */
/* Empty string, return */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -2251,14 +2251,14 @@ static int PH7_builtin_ucfirst(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zString, *zEnd;
int nLen, c;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return */
/* Empty string, return */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -2290,14 +2290,14 @@ static int PH7_builtin_lcfirst(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zString, *zEnd;
int nLen, c;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return */
/* Empty string, return */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -2329,14 +2329,14 @@ static int PH7_builtin_ord(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const unsigned char *zString;
int nLen, c;
if(nArg < 1) {
/* Missing arguments,return -1 */
/* Missing arguments, return -1 */
ph7_result_int(pCtx, -1);
return PH7_OK;
}
/* Extract the target string */
zString = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return -1 */
/* Empty string, return -1 */
ph7_result_int(pCtx, -1);
return PH7_OK;
}
@@ -2358,7 +2358,7 @@ static int PH7_builtin_ord(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int PH7_builtin_chr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int c;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2391,14 +2391,14 @@ static int PH7_builtin_bin2hex(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zString;
int nLen;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return */
/* Empty string, return */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -2480,7 +2480,7 @@ static int PH7_builtin_strstr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nOfft;
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2493,7 +2493,7 @@ static int PH7_builtin_strstr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Perform the lookup */
rc = xPatternMatch(zBlob, (sxu32)nLen, zPattern, (sxu32)nPatLen, &nOfft);
if(rc != SXRET_OK) {
/* Pattern not found,return FALSE */
/* Pattern not found, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2532,7 +2532,7 @@ static int PH7_builtin_stristr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nOfft;
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2545,7 +2545,7 @@ static int PH7_builtin_stristr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Perform the lookup */
rc = xPatternMatch(zBlob, (sxu32)nLen, zPattern, (sxu32)nPatLen, &nOfft);
if(rc != SXRET_OK) {
/* Pattern not found,return FALSE */
/* Pattern not found, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2585,7 +2585,7 @@ static int PH7_builtin_strpos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nOfft;
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2612,7 +2612,7 @@ static int PH7_builtin_strpos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Perform the lookup */
rc = xPatternMatch(zBlob, (sxu32)nLen, zPattern, (sxu32)nPatLen, &nOfft);
if(rc != SXRET_OK) {
/* Pattern not found,return FALSE */
/* Pattern not found, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2645,7 +2645,7 @@ static int PH7_builtin_stripos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nOfft;
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2672,7 +2672,7 @@ static int PH7_builtin_stripos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Perform the lookup */
rc = xPatternMatch(zBlob, (sxu32)nLen, zPattern, (sxu32)nPatLen, &nOfft);
if(rc != SXRET_OK) {
/* Pattern not found,return FALSE */
/* Pattern not found, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2705,7 +2705,7 @@ static int PH7_builtin_strrpos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nOfft;
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2752,13 +2752,13 @@ static int PH7_builtin_strrpos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
}
rc = xPatternMatch((const void *)zPtr, (sxu32)(zEnd - zPtr), (const void *)zPattern, (sxu32)nPatLen, &nOfft);
if(rc == SXRET_OK) {
/* Pattern found,return it's position */
/* Pattern found, return it's position */
ph7_result_int64(pCtx, (ph7_int64)(&zPtr[nOfft] - zStart));
return PH7_OK;
}
zPtr--;
}
/* Pattern not found,return FALSE */
/* Pattern not found, return FALSE */
ph7_result_bool(pCtx, 0);
} else {
ph7_result_bool(pCtx, 0);
@@ -2787,7 +2787,7 @@ static int PH7_builtin_strripos(ph7_context *pCtx, int nArg, ph7_value **apArg)
sxu32 nOfft;
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2834,13 +2834,13 @@ static int PH7_builtin_strripos(ph7_context *pCtx, int nArg, ph7_value **apArg)
}
rc = xPatternMatch((const void *)zPtr, (sxu32)(zEnd - zPtr), (const void *)zPattern, (sxu32)nPatLen, &nOfft);
if(rc == SXRET_OK) {
/* Pattern found,return it's position */
/* Pattern found, return it's position */
ph7_result_int64(pCtx, (ph7_int64)(&zPtr[nOfft] - zStart));
return PH7_OK;
}
zPtr--;
}
/* Pattern not found,return FALSE */
/* Pattern not found, return FALSE */
ph7_result_bool(pCtx, 0);
} else {
ph7_result_bool(pCtx, 0);
@@ -2865,7 +2865,7 @@ static int PH7_builtin_strrchr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zBlob;
int nLen, c;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2888,7 +2888,7 @@ static int PH7_builtin_strrchr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Perform the lookup */
rc = SyByteFind2(zBlob, (sxu32)nLen, c, &nOfft);
if(rc != SXRET_OK) {
/* No such entry,return FALSE */
/* No such entry, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2912,7 +2912,7 @@ static int PH7_builtin_strrev(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zIn, *zEnd;
int nLen, c;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2952,7 +2952,7 @@ static int PH7_builtin_ucwords(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zIn, *zCur, *zEnd;
int nLen, c;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3023,7 +3023,7 @@ static int PH7_builtin_str_repeat(ph7_context *pCtx, int nArg, ph7_value **apArg
int nLen, nMul;
int rc;
if(nArg < 2) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3072,14 +3072,14 @@ static int PH7_builtin_nl2br(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int is_xhtml = 0;
int nLen;
if(nArg < 1) {
/* Missing arguments,return the empty string */
/* Missing arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
/* Extract the target string */
zIn = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty string,return null */
/* Empty string, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3811,7 +3811,7 @@ static int PH7_builtin_sprintf(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zFormat;
int nLen;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return the empty string */
/* Missing/Invalid arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -3851,7 +3851,7 @@ static int PH7_builtin_printf(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zFormat;
int nLen;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return 0 */
/* Missing/Invalid arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -3884,7 +3884,7 @@ static int PH7_builtin_vprintf(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SySet sArg;
int nLen, n;
if(nArg < 2 || !ph7_value_is_string(apArg[0]) || !ph7_value_is_array(apArg[1])) {
/* Missing/Invalid arguments,return 0 */
/* Missing/Invalid arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -3922,7 +3922,7 @@ static int PH7_builtin_vsprintf(ph7_context *pCtx, int nArg, ph7_value **apArg)
SySet sArg;
int nLen, n;
if(nArg < 2 || !ph7_value_is_string(apArg[0]) || !ph7_value_is_array(apArg[1])) {
/* Missing/Invalid arguments,return the empty string */
/* Missing/Invalid arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -3964,14 +3964,14 @@ static int PH7_builtin_size_format(ph7_context *pCtx, int nArg, ph7_value **apAr
ph7_int64 iSize;
int c = -1; /* index in zUnit[] */
if(nArg < 1) {
/* Missing argument,return the empty string */
/* Missing argument, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
/* Extract the given size */
iSize = ph7_value_to_int64(apArg[0]);
if(iSize < 100 /* Bytes */) {
/* Don't bother formatting,return immediately */
/* Don't bother formatting, return immediately */
ph7_result_string(pCtx, "0.1 KB", (int)sizeof("0.1 KB") - 1);
return PH7_OK;
}
@@ -4015,7 +4015,7 @@ static int PH7_builtin_md5(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const void *pIn;
int nLen;
if(nArg < 1) {
/* Missing arguments,return the empty string */
/* Missing arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -4058,7 +4058,7 @@ static int PH7_builtin_sha1(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const void *pIn;
int nLen;
if(nArg < 1) {
/* Missing arguments,return the empty string */
/* Missing arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -4097,7 +4097,7 @@ static int PH7_builtin_crc32(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nCRC;
int nLen;
if(nArg < 1) {
/* Missing arguments,return 0 */
/* Missing arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -4220,7 +4220,7 @@ static int PH7_builtin_str_getcsv(ph7_context *pCtx, int nArg, ph7_value **apArg
int escape = '\\'; /* Escape character */
int nLen;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4434,7 +4434,7 @@ static int PH7_builtin_strip_tags(ph7_context *pCtx, int nArg, ph7_value **apArg
int nTaglen = 0;
int nLen;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return the empty string */
/* Missing/Invalid arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -4462,7 +4462,7 @@ static int PH7_builtin_str_shuffle(ph7_context *pCtx, int nArg, ph7_value **apAr
int nLen, i, c;
sxu32 iR;
if(nArg < 1) {
/* Missing arguments,return the empty string */
/* Missing arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -4505,14 +4505,14 @@ static int PH7_builtin_str_split(ph7_context *pCtx, int nArg, ph7_value **apArg)
int split_len;
int nLen;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Point to the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Nothing to process,return FALSE */
/* Nothing to process, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -4521,7 +4521,7 @@ static int PH7_builtin_str_split(ph7_context *pCtx, int nArg, ph7_value **apArg)
/* Split length */
split_len = ph7_value_to_int(apArg[1]);
if(split_len < 1) {
/* Invalid length,return FALSE */
/* Invalid length, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -4689,7 +4689,7 @@ static int PH7_builtin_strspn(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int iCount = 0;
int rc;
if(nArg < 2) {
/* Missing agruments,return zero */
/* Missing agruments, return zero */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -4698,7 +4698,7 @@ static int PH7_builtin_strspn(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Extract the mask */
zMask = ph7_value_to_string(apArg[1], &iMasklen);
if(iLen < 1 || iMasklen < 1) {
/* Nothing to process,return zero */
/* Nothing to process, return zero */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -4779,7 +4779,7 @@ static int PH7_builtin_strcspn(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int iCount = 0;
int rc;
if(nArg < 2) {
/* Missing agruments,return zero */
/* Missing agruments, return zero */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -4788,12 +4788,12 @@ static int PH7_builtin_strcspn(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Extract the mask */
zMask = ph7_value_to_string(apArg[1], &iMasklen);
if(iLen < 1) {
/* Nothing to process,return zero */
/* Nothing to process, return zero */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
if(iMasklen < 1) {
/* No given mask,return the string length */
/* No given mask, return the string length */
ph7_result_int(pCtx, iLen);
return PH7_OK;
}
@@ -4860,7 +4860,7 @@ static int PH7_builtin_strpbrk(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nOfft, nMax;
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -4868,7 +4868,7 @@ static int PH7_builtin_strpbrk(ph7_context *pCtx, int nArg, ph7_value **apArg) {
zString = ph7_value_to_string(apArg[0], &iLen);
zList = ph7_value_to_string(apArg[1], &iListLen);
if(iLen < 1) {
/* Nothing to process,return FALSE */
/* Nothing to process, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -4886,7 +4886,7 @@ static int PH7_builtin_strpbrk(ph7_context *pCtx, int nArg, ph7_value **apArg) {
}
}
if(nOfft == SXU32_HIGH) {
/* No such substring,return FALSE */
/* No such substring, return FALSE */
ph7_result_bool(pCtx, 0);
} else {
/* Return the substring */
@@ -4921,7 +4921,7 @@ static int PH7_builtin_soundex(ph7_context *pCtx, int nArg, ph7_value **apArg) {
1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
};
if(nArg < 1) {
/* Missing arguments,return the empty string */
/* Missing arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -4967,14 +4967,14 @@ static int PH7_builtin_wordwrap(ph7_context *pCtx, int nArg, ph7_value **apArg)
const char *zIn, *zEnd, *zBreak;
int iLen, iBreaklen, iChunk;
if(nArg < 1) {
/* Missing arguments,return the empty string */
/* Missing arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
/* Extract the input string */
zIn = ph7_value_to_string(apArg[0], &iLen);
if(iLen < 1) {
/* Nothing to process,return the empty string */
/* Nothing to process, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -5114,7 +5114,7 @@ static int PH7_builtin_strtok(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Extract top aux data */
pAux = (strtok_aux_data *)ph7_context_peek_aux_data(pCtx);
if(pAux == 0) {
/* No aux data,return FALSE */
/* No aux data, return FALSE */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -5125,7 +5125,7 @@ static int PH7_builtin_strtok(ph7_context *pCtx, int nArg, ph7_value **apArg) {
zMask = ph7_value_to_string(apArg[0], &nMasklen);
}
if(nMasklen < 1) {
/* Invalid mask,return FALSE */
/* Invalid mask, return FALSE */
ph7_context_free_chunk(pCtx, (void *)pAux->zDup);
ph7_context_free_chunk(pCtx, pAux);
(void)ph7_context_pop_aux_data(pCtx);
@@ -5151,7 +5151,7 @@ static int PH7_builtin_strtok(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Extract the raw input */
zCur = zInput = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Empty input,return FALSE */
/* Empty input, return FALSE */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -5218,7 +5218,7 @@ static int PH7_builtin_str_pad(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int iLen, iPadlen, iType, i, iDiv, iStrpad, iRealPad, jPad;
const char *zIn, *zPad;
if(nArg < 2) {
/* Missing arguments,return the empty string */
/* Missing arguments, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -5391,7 +5391,7 @@ static int StringReplaceWalker(ph7_value *pKey, ph7_value *pData, void *pUserDat
/* Extract the target and the replace */
zTarget = ph7_value_to_string(pKey, &tLen);
if(tLen < 1) {
/* Empty target,return immediately */
/* Empty target, return immediately */
return PH7_OK;
}
/* Perform a pattern search */
@@ -5478,7 +5478,7 @@ static int PH7_builtin_str_replace(ph7_context *pCtx, int nArg, ph7_value **apAr
int nByte;
sxi32 rc;
if(nArg < 3) {
/* Missing/Invalid arguments,return null */
/* Missing/Invalid arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -5493,7 +5493,7 @@ static int PH7_builtin_str_replace(ph7_context *pCtx, int nArg, ph7_value **apAr
/* Extract the subject */
zIn = ph7_value_to_string(apArg[2], &nByte);
if(nByte < 1) {
/* Nothing to replace,return the empty string */
/* Nothing to replace, return the empty string */
ph7_result_string(pCtx, "", 0);
return PH7_OK;
}
@@ -5610,7 +5610,7 @@ static int PH7_builtin_strtr(ph7_context *pCtx, int nArg, ph7_value **apArg) {
const char *zIn;
int nLen;
if(nArg < 1) {
/* Nothing to replace,return FALSE */
/* Nothing to replace, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -5882,7 +5882,7 @@ static int PH7_builtin_parse_ini_string(ph7_context *pCtx, int nArg, ph7_value *
const char *zIni;
int nByte;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return FALSE*/
/* Missing/Invalid arguments, return FALSE*/
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -6676,7 +6676,7 @@ static int PH7_builtin_date(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int nLen;
Sytm sTm;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid argument,return FALSE */
/* Missing/Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -6736,7 +6736,7 @@ static int PH7_builtin_strftime(ph7_context *pCtx, int nArg, ph7_value **apArg)
int nLen;
Sytm sTm;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid argument,return FALSE */
/* Missing/Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -6776,7 +6776,7 @@ static int PH7_builtin_strftime(ph7_context *pCtx, int nArg, ph7_value **apArg)
/* Format the given string */
PH7_Strftime(pCtx, zFormat, nLen, &sTm);
if(ph7_context_result_buf_length(pCtx) < 1) {
/* Nothing was formatted,return FALSE */
/* Nothing was formatted, return FALSE */
ph7_result_bool(pCtx, 0);
}
return PH7_OK;
@@ -6800,7 +6800,7 @@ static int PH7_builtin_gmdate(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int nLen;
Sytm sTm;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid argument,return FALSE */
/* Missing/Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7028,7 +7028,7 @@ static int PH7_builtin_idate(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int nLen;
Sytm sTm;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid argument,return -1 */
/* Missing/Invalid argument, return -1 */
ph7_result_int(pCtx, -1);
return PH7_OK;
}
@@ -7289,14 +7289,14 @@ static int PH7_builtin_base64_encode(ph7_context *pCtx, int nArg, ph7_value **ap
const char *zIn;
int nLen;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Extract the input string */
zIn = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Nothing to process,return FALSE */
/* Nothing to process, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7318,14 +7318,14 @@ static int PH7_builtin_base64_decode(ph7_context *pCtx, int nArg, ph7_value **ap
const char *zIn;
int nLen;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Extract the input string */
zIn = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Nothing to process,return FALSE */
/* Nothing to process, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7348,14 +7348,14 @@ static int PH7_builtin_urlencode(ph7_context *pCtx, int nArg, ph7_value **apArg)
const char *zIn;
int nLen;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Extract the input string */
zIn = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Nothing to process,return FALSE */
/* Nothing to process, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7377,14 +7377,14 @@ static int PH7_builtin_urldecode(ph7_context *pCtx, int nArg, ph7_value **apArg)
const char *zIn;
int nLen;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Extract the input string */
zIn = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Nothing to process,return FALSE */
/* Nothing to process, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}

View File

@@ -4929,7 +4929,7 @@ static ProcLangConstruct PH7_GenStateGetStatementHandler(
if(nKeywordID == PH7_KEYWORD_STATIC && pLookahead && (pLookahead->nType & PH7_TK_OP)) {
const ph7_expr_op *pOp = (const ph7_expr_op *)pLookahead->pUserData;
if(pOp && pOp->iOp == EXPR_OP_DC /*::*/) {
/* 'static' (class context),return null */
/* 'static' (class context), return null */
return 0;
}
}
@@ -5247,7 +5247,7 @@ PH7_PRIVATE sxi32 PH7_GenCompileError(ph7_gen_state *pGen, sxi32 nErrType, sxu32
/* Peek the processed file path if available */
pFile = (SyString *)SySetPeek(&pGen->pVm->aFiles);
if(pGen->xErr == 0) {
/* No available error consumer,return immediately */
/* No available error consumer, return immediately */
return SXRET_OK;
}
switch(nErrType) {

View File

@@ -227,7 +227,7 @@ static sxi32 HashmapGrowBucket(ph7_hashmap *pMap) {
pMap->apBucket = apNew;
pMap->nSize = nNew;
if(apOld == 0) {
/* First allocated table [i.e: no entry],return immediately */
/* First allocated table [i.e: no entry], return immediately */
return SXRET_OK;
}
/* Rehash old entries */
@@ -1315,7 +1315,7 @@ PH7_PRIVATE void PH7_HashmapResetLoopCursor(ph7_hashmap *pMap) {
PH7_PRIVATE ph7_hashmap_node *PH7_HashmapGetNextEntry(ph7_hashmap *pMap) {
ph7_hashmap_node *pCur = pMap->pCur;
if(pCur == 0) {
/* End of the list,return null */
/* End of the list, return null */
return 0;
}
/* Advance the node cursor */
@@ -1782,7 +1782,7 @@ static int ph7_hashmap_sort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1802,7 +1802,7 @@ static int ph7_hashmap_sort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Rehash [Do not maintain index association as requested by the PHP specification] */
HashmapSortRehash(pMap);
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -1825,7 +1825,7 @@ static int ph7_hashmap_asort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1847,7 +1847,7 @@ static int ph7_hashmap_asort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -1870,7 +1870,7 @@ static int ph7_hashmap_arsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1892,7 +1892,7 @@ static int ph7_hashmap_arsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -1915,7 +1915,7 @@ static int ph7_hashmap_ksort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1937,7 +1937,7 @@ static int ph7_hashmap_ksort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -1960,7 +1960,7 @@ static int ph7_hashmap_krsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1982,7 +1982,7 @@ static int ph7_hashmap_krsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2005,7 +2005,7 @@ static int ph7_hashmap_rsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2025,7 +2025,7 @@ static int ph7_hashmap_rsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Rehash [Do not maintain index association as requested by the PHP specification] */
HashmapSortRehash(pMap);
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2047,7 +2047,7 @@ static int ph7_hashmap_usort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2069,7 +2069,7 @@ static int ph7_hashmap_usort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Rehash [Do not maintain index association as requested by the PHP specification] */
HashmapSortRehash(pMap);
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2092,7 +2092,7 @@ static int ph7_hashmap_uasort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2116,7 +2116,7 @@ static int ph7_hashmap_uasort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2139,7 +2139,7 @@ static int ph7_hashmap_uksort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2163,7 +2163,7 @@ static int ph7_hashmap_uksort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2181,7 +2181,7 @@ static int ph7_hashmap_shuffle(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2195,7 +2195,7 @@ static int ph7_hashmap_shuffle(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2217,7 +2217,7 @@ static int ph7_hashmap_count(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int bRecursive = FALSE;
sxi64 iCount;
if(nArg < 1) {
/* Missing arguments,return 0 */
/* Missing arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -2248,13 +2248,13 @@ static int ph7_hashmap_count(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int ph7_hashmap_key_exists(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[1])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2275,19 +2275,19 @@ static int ph7_hashmap_key_exists(ph7_context *pCtx, int nArg, ph7_value **apArg
static int ph7_hashmap_pop(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return null */
/* Invalid argument, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Noting to pop,return NULL */
/* Noting to pop, return NULL */
ph7_result_null(pCtx);
} else {
ph7_hashmap_node *pLast = pMap->pLast;
@@ -2322,13 +2322,13 @@ static int ph7_hashmap_push(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
int i;
if(nArg < 1) {
/* Missing arguments,return 0 */
/* Missing arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return 0 */
/* Invalid argument, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -2356,20 +2356,20 @@ static int ph7_hashmap_push(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int ph7_hashmap_shift(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return null */
/* Invalid argument, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Point to the internal representation of the hashmap */
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Empty hashmap,return NULL */
/* Empty hashmap, return NULL */
ph7_result_null(pCtx);
} else {
ph7_hashmap_node *pEntry = pMap->pFirst;
@@ -2411,7 +2411,7 @@ static sxi32 HashmapCurrentValue(ph7_context *pCtx, ph7_hashmap *pMap, int iDire
ph7_hashmap_node *pCur = pMap->pCur;
ph7_value *pVal;
if(pCur == 0) {
/* Cursor does not point to anything,return FALSE */
/* Cursor does not point to anything, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2426,7 +2426,7 @@ static sxi32 HashmapCurrentValue(ph7_context *pCtx, ph7_hashmap *pMap, int iDire
pCur = pMap->pCur;
}
if(pCur == 0) {
/* End of input reached,return FALSE */
/* End of input reached, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2453,13 +2453,13 @@ static sxi32 HashmapCurrentValue(ph7_context *pCtx, ph7_hashmap *pMap, int iDire
*/
static int ph7_hashmap_current(ph7_context *pCtx, int nArg, ph7_value **apArg) {
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2478,13 +2478,13 @@ static int ph7_hashmap_current(ph7_context *pCtx, int nArg, ph7_value **apArg) {
*/
static int ph7_hashmap_next(ph7_context *pCtx, int nArg, ph7_value **apArg) {
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2503,13 +2503,13 @@ static int ph7_hashmap_next(ph7_context *pCtx, int nArg, ph7_value **apArg) {
*/
static int ph7_hashmap_prev(ph7_context *pCtx, int nArg, ph7_value **apArg) {
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2527,13 +2527,13 @@ static int ph7_hashmap_prev(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int ph7_hashmap_end(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2556,13 +2556,13 @@ static int ph7_hashmap_end(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int ph7_hashmap_reset(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2590,20 +2590,20 @@ static int ph7_hashmap_simple_key(ph7_context *pCtx, int nArg, ph7_value **apArg
ph7_hashmap_node *pCur;
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
pCur = pMap->pCur;
if(pCur == 0) {
/* Cursor does not point to anything,return NULL */
/* Cursor does not point to anything, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2637,20 +2637,20 @@ static int ph7_hashmap_each(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pVal;
ph7_value sKey;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Point to the internal representation that describe the input hashmap */
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->pCur == 0) {
/* Cursor does not point to anything,return FALSE */
/* Cursor does not point to anything, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2757,13 +2757,13 @@ static int ph7_hashmap_values(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pObj;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2814,13 +2814,13 @@ static int ph7_hashmap_keys(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2884,7 +2884,7 @@ static int ph7_hashmap_merge(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
int i;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2964,7 +2964,7 @@ static int ph7_hashmap_slice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int bPreserve;
sxi32 rc;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2977,7 +2977,7 @@ static int ph7_hashmap_slice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
iOfft = (int)pSrc->nEntry + iOfft;
}
if(iOfft < 0 || iOfft > (int)pSrc->nEntry) {
/* Invalid offset,return the last entry */
/* Invalid offset, return the last entry */
iOfft = (int)pSrc->nEntry - 1;
}
/* Get the length */
@@ -3001,7 +3001,7 @@ static int ph7_hashmap_slice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
return PH7_OK;
}
if(iLength < 1) {
/* Don't bother processing,return the empty array */
/* Don't bother processing, return the empty array */
ph7_result_value(pCtx, pArray);
return PH7_OK;
}
@@ -3066,7 +3066,7 @@ static int ph7_hashmap_splice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int iLength, iOfft;
sxi32 rc;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3099,7 +3099,7 @@ static int ph7_hashmap_splice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
return PH7_OK;
}
if(iLength < 1) {
/* Don't bother processing,return the empty array */
/* Don't bother processing, return the empty array */
ph7_result_value(pCtx, pArray);
return PH7_OK;
}
@@ -3184,7 +3184,7 @@ static int ph7_hashmap_in_array(ph7_context *pCtx, int nArg, ph7_value **apArg)
int bStrict;
int rc;
if(nArg < 2) {
/* Missing argument,return FALSE */
/* Missing argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -3230,13 +3230,13 @@ static int ph7_hashmap_search(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 n;
int rc;
if(nArg < 2) {
/* Missing argument,return FALSE*/
/* Missing argument, return FALSE*/
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
bStrict = FALSE;
if(!ph7_value_is_array(apArg[1])) {
/* hasystack must be an array,return FALSE */
/* hasystack must be an array, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -3266,7 +3266,7 @@ static int ph7_hashmap_search(ph7_context *pCtx, int nArg, ph7_value **apArg) {
PH7_MemObjRelease(&sVal);
PH7_MemObjRelease(&sNeedle);
if(rc == 0) {
/* Match found,return key */
/* Match found, return key */
if(pEntry->iType == HASHMAP_INT_NODE) {
/* INT key */
ph7_result_int64(pCtx, pEntry->xKey.iKey);
@@ -3282,7 +3282,7 @@ static int ph7_hashmap_search(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pEntry = pEntry->pPrev; /* Reverse link */
n--;
}
/* No such value,return FALSE */
/* No such value, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -3309,7 +3309,7 @@ static int ph7_hashmap_diff(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3393,7 +3393,7 @@ static int ph7_hashmap_udiff(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 n;
int i;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3472,7 +3472,7 @@ static int ph7_hashmap_diff_assoc(ph7_context *pCtx, int nArg, ph7_value **apArg
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3566,7 +3566,7 @@ static int ph7_hashmap_diff_uassoc(ph7_context *pCtx, int nArg, ph7_value **apAr
sxu32 n;
int i;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3656,7 +3656,7 @@ static int ph7_hashmap_diff_key(ph7_context *pCtx, int nArg, ph7_value **apArg)
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3735,7 +3735,7 @@ static int ph7_hashmap_intersect(ph7_context *pCtx, int nArg, ph7_value **apArg)
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3813,7 +3813,7 @@ static int ph7_hashmap_intersect_assoc(ph7_context *pCtx, int nArg, ph7_value **
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3901,7 +3901,7 @@ static int ph7_hashmap_intersect_key(ph7_context *pCtx, int nArg, ph7_value **ap
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3987,7 +3987,7 @@ static int ph7_hashmap_uintersect(ph7_context *pCtx, int nArg, ph7_value **apArg
sxu32 n;
int i;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4060,7 +4060,7 @@ static int ph7_hashmap_fill(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
int i, nEntry;
if(nArg < 3) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4099,13 +4099,13 @@ static int ph7_hashmap_fill_keys(ph7_context *pCtx, int nArg, ph7_value **apArg)
ph7_value *pArray;
sxu32 n;
if(nArg < 2) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4147,13 +4147,13 @@ static int ph7_hashmap_combine(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
sxu32 n;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0]) || !ph7_value_is_array(apArg[1])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -4161,7 +4161,7 @@ static int ph7_hashmap_combine(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pKey = (ph7_hashmap *)apArg[0]->x.pOther;
pValue = (ph7_hashmap *)apArg[1]->x.pOther;
if(pKey->nEntry != pValue->nEntry) {
/* Array length differs,return FALSE */
/* Array length differs, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -4202,13 +4202,13 @@ static int ph7_hashmap_reverse(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int bPreserve;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4259,13 +4259,13 @@ static int ph7_hashmap_unique(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4317,13 +4317,13 @@ static int ph7_hashmap_flip(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value sVal;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4432,19 +4432,19 @@ static int ph7_hashmap_sum(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
ph7_value *pObj;
if(nArg < 1) {
/* Missing arguments,return 0 */
/* Missing arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return 0 */
/* Invalid argument, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Nothing to compute,return 0 */
/* Nothing to compute, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -4534,19 +4534,19 @@ static int ph7_hashmap_product(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
ph7_value *pObj;
if(nArg < 1) {
/* Missing arguments,return 0 */
/* Missing arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return 0 */
/* Invalid argument, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Nothing to compute,return 0 */
/* Nothing to compute, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -4583,7 +4583,7 @@ static int ph7_hashmap_rand(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
int nItem = 1;
if(nArg < 1) {
/* Missing argument,return NULL */
/* Missing argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4595,7 +4595,7 @@ static int ph7_hashmap_rand(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Point to the internal representation of the input hashmap */
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Empty hashmap,return NULL */
/* Empty hashmap, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4698,7 +4698,7 @@ static int ph7_hashmap_chunk(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nSize;
sxu32 n;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4779,7 +4779,7 @@ static int ph7_hashmap_pad(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
int nEntry;
if(nArg < 3 || !ph7_value_is_array(apArg[0])) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4850,7 +4850,7 @@ static int ph7_hashmap_replace(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
int i;
if(nArg < 1) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4896,7 +4896,7 @@ static int ph7_hashmap_filter(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int keep;
sxu32 n;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4958,7 +4958,7 @@ static int ph7_hashmap_map(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
sxu32 n;
if(nArg < 2 || !ph7_value_is_array(apArg[1])) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -5023,7 +5023,7 @@ static int ph7_hashmap_reduce(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value sResult;
sxu32 n;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Invalid/Missing arguments,return NULL */
/* Invalid/Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -5076,7 +5076,7 @@ static int ph7_hashmap_walk(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
sxu32 n;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Invalid/Missing arguments,return FALSE */
/* Invalid/Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -5105,7 +5105,7 @@ static int ph7_hashmap_walk(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Point to the next entry */
pEntry = pEntry->pPrev; /* Reverse link */
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -5177,7 +5177,7 @@ static int ph7_hashmap_walk_recursive(ph7_context *pCtx, int nArg, ph7_value **a
ph7_hashmap *pMap;
sxi32 rc;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Invalid/Missing arguments,return FALSE */
/* Invalid/Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}

View File

@@ -210,7 +210,7 @@ PH7_PRIVATE SyHashEntry *SyHashGet(SyHash *pHash, const void *pKey, sxu32 nKeyLe
return 0;
}
if(pHash->nEntry < 1 || nKeyLen < 1) {
/* Don't bother hashing,return immediately */
/* Don't bother hashing, return immediately */
return 0;
}
pEntry = HashGetEntry(&(*pHash), pKey, nKeyLen);

View File

@@ -673,7 +673,7 @@ static void PH7_ClassInstanceRelease(ph7_class_instance *pThis) {
ph7_vm *pVm;
if(pThis->iFlags & CLASS_INSTANCE_DESTROYED) {
/*
* Already destroyed,return immediately.
* Already destroyed, return immediately.
* This could happend if someone perform unset($this) in the destructor body.
*/
return;
@@ -979,7 +979,7 @@ PH7_PRIVATE sxi32 PH7_ClassInstanceCallMagicMethod(
/* Make sure the magic method is available */
pMeth = PH7_ClassExtractMethod(&(*pClass), zMethod, nByte);
if(pMeth == 0) {
/* No such method,return immediately */
/* No such method, return immediately */
return SXERR_NOTFOUND;
}
nArg = 0;

View File

@@ -5462,7 +5462,7 @@ static int vm_builtin_func_exists(ph7_context *pCtx, int nArg, ph7_value **apArg
int nLen;
int res;
if(nArg < 1) {
/* Missing argument,return FALSE */
/* Missing argument, return FALSE */
ph7_result_bool(pCtx, 0);
return SXRET_OK;
}
@@ -5557,7 +5557,7 @@ static int vm_builtin_is_callable(ph7_context *pCtx, int nArg, ph7_value **apArg
ph7_vm *pVm;
int res;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return SXRET_OK;
}
@@ -5618,7 +5618,7 @@ static int vm_builtin_register_shutdown_function(ph7_context *pCtx, int nArg, ph
VmShutdownCB sEntry;
int i, j;
if(nArg < 1 || (apArg[0]->nType & (MEMOBJ_STRING | MEMOBJ_HASHMAP)) == 0) {
/* Missing/Invalid arguments,return immediately */
/* Missing/Invalid arguments, return immediately */
return PH7_OK;
}
/* Zero the Entry */
@@ -5660,7 +5660,7 @@ PH7_PRIVATE ph7_class *PH7_VmExtractActiveClass(ph7_vm *pVm, sxi32 iDepth) {
SySet *pSet = &pVm->aSelf;
ph7_class **apClass;
if(SySetUsed(pSet) <= 0) {
/* Empty stack,return NULL */
/* Empty stack, return NULL */
return 0;
}
/* Extract the class entry from specified depth */
@@ -5689,7 +5689,7 @@ static int vm_builtin_get_class(ph7_context *pCtx, int nArg, ph7_value **apArg)
pName = &pClass->sName;
ph7_result_string(pCtx, pName->zString, (int)pName->nByte);
} else {
/* Not inside class,return FALSE */
/* Not inside class, return FALSE */
ph7_result_bool(pCtx, 0);
}
} else {
@@ -5700,7 +5700,7 @@ static int vm_builtin_get_class(ph7_context *pCtx, int nArg, ph7_value **apArg)
/* Return the class name */
ph7_result_string(pCtx, pName->zString, (int)pName->nByte);
} else {
/* Not a class instance,return FALSE */
/* Not a class instance, return FALSE */
ph7_result_bool(pCtx, 0);
}
}
@@ -5729,7 +5729,7 @@ static int vm_builtin_get_parent_class(ph7_context *pCtx, int nArg, ph7_value **
pName = &pClass->pBase->sName;
ph7_result_string(pCtx, pName->zString, (int)pName->nByte);
} else {
/* Not inside class,return FALSE */
/* Not inside class, return FALSE */
ph7_result_bool(pCtx, 0);
}
} else {
@@ -5745,7 +5745,7 @@ static int vm_builtin_get_parent_class(ph7_context *pCtx, int nArg, ph7_value **
ph7_result_bool(pCtx, 0);
}
} else {
/* Not a class instance,return FALSE */
/* Not a class instance, return FALSE */
ph7_result_bool(pCtx, 0);
}
}
@@ -5771,7 +5771,7 @@ static int vm_builtin_get_called_class(ph7_context *pCtx, int nArg, ph7_value **
} else {
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
/* Not inside class,return FALSE */
/* Not inside class, return FALSE */
ph7_result_bool(pCtx, 0);
}
return PH7_OK;
@@ -5960,7 +5960,7 @@ static int vm_builtin_get_declared_classes(ph7_context *pCtx, int nArg, ph7_valu
if(pArray == 0 || pName == 0) {
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6001,7 +6001,7 @@ static int vm_builtin_get_declared_interfaces(ph7_context *pCtx, int nArg, ph7_v
if(pArray == 0 || pName == 0) {
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6044,7 +6044,7 @@ static int vm_builtin_get_class_methods(ph7_context *pCtx, int nArg, ph7_value *
pClass = VmExtractClassFromValue(pCtx->pVm, apArg[0]);
}
if(pClass == 0) {
/* No such class,return NULL */
/* No such class, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6052,7 +6052,7 @@ static int vm_builtin_get_class_methods(ph7_context *pCtx, int nArg, ph7_value *
pArray = ph7_context_new_array(pCtx);
pName = ph7_context_new_scalar(pCtx);
if(pArray == 0 || pName == 0) {
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6134,7 +6134,7 @@ static int vm_builtin_get_class_vars(ph7_context *pCtx, int nArg, ph7_value **ap
pClass = VmExtractClassFromValue(pCtx->pVm, apArg[0]);
}
if(pClass == 0) {
/* No such class,return NULL */
/* No such class, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6143,7 +6143,7 @@ static int vm_builtin_get_class_vars(ph7_context *pCtx, int nArg, ph7_value **ap
pName = ph7_context_new_scalar(pCtx);
PH7_MemObjInit(pCtx->pVm, &sValue);
if(pArray == 0 || pName == 0) {
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6204,7 +6204,7 @@ static int vm_builtin_get_object_vars(ph7_context *pCtx, int nArg, ph7_value **a
pThis = (ph7_class_instance *)apArg[0]->x.pOther;
}
if(pThis == 0) {
/* No such instance,return NULL */
/* No such instance, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6212,7 +6212,7 @@ static int vm_builtin_get_object_vars(ph7_context *pCtx, int nArg, ph7_value **a
pArray = ph7_context_new_array(pCtx);
pName = ph7_context_new_scalar(pCtx);
if(pArray == 0 || pName == 0) {
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6673,7 +6673,7 @@ static int vm_builtin_ob_end_clean(ph7_context *pCtx, int nArg, ph7_value **apAr
/* Pop the top most OB */
pOb = (VmObEntry *)SySetPop(&pVm->aOB);
if(pOb == 0) {
/* No such OB,return FALSE */
/* No such OB, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -6699,7 +6699,7 @@ static int vm_builtin_ob_get_contents(ph7_context *pCtx, int nArg, ph7_value **a
/* Peek the top most OB */
pOb = (VmObEntry *)SySetPeek(&pVm->aOB);
if(pOb == 0) {
/* No active OB,return FALSE */
/* No active OB, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -6724,7 +6724,7 @@ static int vm_builtin_ob_get_clean(ph7_context *pCtx, int nArg, ph7_value **apAr
/* Pop the top most OB */
pOb = (VmObEntry *)SySetPop(&pVm->aOB);
if(pOb == 0) {
/* No active OB,return FALSE */
/* No active OB, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -6750,7 +6750,7 @@ static int vm_builtin_ob_get_length(ph7_context *pCtx, int nArg, ph7_value **apA
/* Peek the top most OB */
pOb = (VmObEntry *)SySetPeek(&pVm->aOB);
if(pOb == 0) {
/* No active OB,return FALSE */
/* No active OB, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -6928,7 +6928,7 @@ static int vm_builtin_ob_flush(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Peek the top most OB entry */
pOb = (VmObEntry *)SySetPeek(&pVm->aOB);
if(pOb == 0) {
/* Empty stack,return immediately */
/* Empty stack, return immediately */
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
return PH7_OK;
@@ -6954,7 +6954,7 @@ static int vm_builtin_ob_end_flush(ph7_context *pCtx, int nArg, ph7_value **apAr
/* Pop the top most OB entry */
pOb = (VmObEntry *)SySetPop(&pVm->aOB);
if(pOb == 0) {
/* Empty stack,return FALSE */
/* Empty stack, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -7001,14 +7001,14 @@ static int vm_builtin_ob_list_handlers(ph7_context *pCtx, int nArg, ph7_value **
ph7_value sVal;
sxu32 n;
if(SySetUsed(&pVm->aOB) < 1) {
/* Empty stack,return null */
/* Empty stack, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Create a new array */
pArray = ph7_context_new_array(pCtx);
if(pArray == 0) {
/* Out of memory,return NULL */
/* Out of memory, return NULL */
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
ph7_result_null(pCtx);
@@ -7522,7 +7522,7 @@ static int vm_builtin_get_defined_vars(ph7_context *pCtx, int nArg, ph7_value **
SyHashForEach(&pVm->hSuper, VmHashVarWalker, pArray);
/* Then variable defined in the current frame */
SyHashForEach(&pVm->pFrame->hVar, VmHashVarWalker, pArray);
/* Finally,return the created array */
/* Finally, return the created array */
ph7_result_value(pCtx, pArray);
return SXRET_OK;
}
@@ -7559,7 +7559,7 @@ static int vm_builtin_gettype(ph7_context *pCtx, int nArg, ph7_value **apArg) {
*/
static int vm_builtin_get_resource_type(ph7_context *pCtx, int nArg, ph7_value **apArg) {
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
/* Missing/Invalid arguments,return FALSE*/
/* Missing/Invalid arguments, return FALSE*/
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7610,7 +7610,7 @@ static int vm_builtin_print_r(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int ret_string = 0;
SyBlob sDump;
if(nArg < 1) {
/* Nothing to output,return FALSE */
/* Nothing to output, return FALSE */
ph7_result_bool(pCtx, 0);
return SXRET_OK;
}
@@ -7642,7 +7642,7 @@ static int vm_builtin_var_export(ph7_context *pCtx, int nArg, ph7_value **apArg)
int ret_string = 0;
SyBlob sDump; /* Dump is stored in this BLOB */
if(nArg < 1) {
/* Nothing to output,return FALSE */
/* Nothing to output, return FALSE */
ph7_result_bool(pCtx, 0);
return SXRET_OK;
}
@@ -7735,7 +7735,7 @@ static int vm_builtin_assert_options(ph7_context *pCtx, int nArg, ph7_value **ap
ph7_vm *pVm = pCtx->pVm;
int iOld, iNew, iValue;
if(nArg < 1 || !ph7_value_is_int(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7796,13 +7796,13 @@ static int vm_builtin_assert(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pAssert;
int iFlags, iResult;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
iFlags = pVm->iAssertFlags;
if(iFlags & PH7_ASSERT_DISABLE) {
/* Assertion is disabled,return FALSE */
/* Assertion is disabled, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7884,7 +7884,7 @@ static int vm_builtin_restore_exception_handler(ph7_context *pCtx, int nArg, ph7
if(pOld->nType & MEMOBJ_NULL) {
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
/* No installed handler,return FALSE */
/* No installed handler, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7924,7 +7924,7 @@ static int vm_builtin_set_exception_handler(ph7_context *pCtx, int nArg, ph7_val
ph7_result_value(pCtx, pOld); /* Will make it's own copy */
if(nArg > 0) {
if(!ph7_value_is_callable(apArg[0])) {
/* Not callable,return TRUE (As requested by the PHP specification) */
/* Not callable, return TRUE (As requested by the PHP specification) */
PH7_MemObjRelease(pNew);
ph7_result_bool(pCtx, 1);
} else {
@@ -8429,21 +8429,21 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
int nLen;
sxi32 rc;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Extract the given URI */
zStr = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Nothing to process,return FALSE */
/* Nothing to process, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Get a parse */
rc = VmHttpSplitURI(&sURI, zStr, (sxu32)nLen);
if(rc != SXRET_OK) {
/* Malformed input,return FALSE */
/* Malformed input, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -8454,7 +8454,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 1: /* PHP_URL_SCHEME */
pComp = &sURI.sScheme;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8463,7 +8463,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 2: /* PHP_URL_HOST */
pComp = &sURI.sHost;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8472,7 +8472,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 3: /* PHP_URL_PORT */
pComp = &sURI.sPort;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
int iPort = 0;
@@ -8484,7 +8484,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 4: /* PHP_URL_USER */
pComp = &sURI.sUser;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8493,7 +8493,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 5: /* PHP_URL_PASS */
pComp = &sURI.sPass;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8502,7 +8502,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 7: /* PHP_URL_QUERY */
pComp = &sURI.sQuery;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8511,7 +8511,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 8: /* PHP_URL_FRAGMENT */
pComp = &sURI.sFragment;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8520,14 +8520,14 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 6: /* PHP_URL_PATH */
pComp = &sURI.sPath;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
}
break;
default:
/* No such entry,return NULL */
/* No such entry, return NULL */
ph7_result_null(pCtx);
break;
}
@@ -8684,7 +8684,7 @@ static int vm_builtin_compact(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyString sVar;
int i, nLen;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -8780,14 +8780,14 @@ static int vm_builtin_extract(ph7_context *pCtx, int nArg, ph7_value **apArg) {
extract_aux_data sAux;
ph7_hashmap *pMap;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return 0 */
/* Missing/Invalid arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
/* Point to the target hashmap */
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Empty map,return 0 */
/* Empty map, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -8943,14 +8943,14 @@ Cleanup:
static int vm_builtin_eval(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyString sChunk; /* Chunk to evaluate */
if(nArg < 1) {
/* Nothing to evaluate,return NULL */
/* Nothing to evaluate, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* Chunk to evaluate */
sChunk.zString = ph7_value_to_string(apArg[0], (int *)&sChunk.nByte);
if(sChunk.nByte < 1) {
/* Empty string,return NULL */
/* Empty string, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
@@ -9205,7 +9205,7 @@ static int vm_builtin_get_included_files(ph7_context *pCtx, int nArg, ph7_value
pArray = ph7_context_new_array(pCtx);
pWorker = ph7_context_new_scalar(pCtx);
if(pArray == 0 || pWorker == 0) {
/* Out of memory,return null */
/* Out of memory, return null */
ph7_result_null(pCtx);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -9221,7 +9221,7 @@ static int vm_builtin_get_included_files(ph7_context *pCtx, int nArg, ph7_value
/* Perform the insertion */
ph7_array_add_elem(pArray, 0/* Automatic index assign*/, pWorker); /* Will make it's own copy */
}
/* All done,return the created array */
/* All done, return the created array */
ph7_result_value(pCtx, pArray);
/* Note that 'pWorker' will be automatically destroyed
* by the engine as soon we return from this foreign
@@ -9245,21 +9245,21 @@ static int vm_builtin_include(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyString sFile;
sxi32 rc;
if(nArg < 1) {
/* Nothing to evaluate,return NULL */
/* Nothing to evaluate, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* File to include */
sFile.zString = ph7_value_to_string(apArg[0], (int *)&sFile.nByte);
if(sFile.nByte < 1) {
/* Empty string,return NULL */
/* Empty string, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* Open,compile and execute the desired script */
rc = VmExecIncludedFile(&(*pCtx), &sFile, TRUE);
if(rc == SXERR_EXISTS) {
/* File already included,return TRUE */
/* File already included, return TRUE */
ph7_result_bool(pCtx, 1);
return SXRET_OK;
}
@@ -9280,21 +9280,21 @@ static int vm_builtin_require(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyString sFile;
sxi32 rc;
if(nArg < 1) {
/* Nothing to evaluate,return NULL */
/* Nothing to evaluate, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* File to include */
sFile.zString = ph7_value_to_string(apArg[0], (int *)&sFile.nByte);
if(sFile.nByte < 1) {
/* Empty string,return NULL */
/* Empty string, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* Open,compile and execute the desired script */
rc = VmExecIncludedFile(&(*pCtx), &sFile, TRUE);
if(rc == SXERR_EXISTS) {
/* File already included,return TRUE */
/* File already included, return TRUE */
ph7_result_bool(pCtx, 1);
return SXRET_OK;
}
@@ -9349,7 +9349,7 @@ static const char *VmFindLongOpt(const char *zLong, int nByte, const char *zIn,
}
/* Test */
if((int)(zIn - zOpt) == nByte && SyMemcmp(zOpt, zLong, nByte) == 0) {
/* Got one,return it's value */
/* Got one, return it's value */
return zIn;
}
} else {
@@ -9508,7 +9508,7 @@ static int vm_builtin_getopt(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyBlob *pArg;
int nByte;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
PH7_VmThrowError(pCtx->pVm, PH7_CTX_ERR, "Missing/Invalid option arguments");
}
/* Extract option arguments */
@@ -9523,7 +9523,7 @@ static int vm_builtin_getopt(ph7_context *pCtx, int nArg, ph7_value **apArg) {
PH7_VmMemoryError(pCtx->pVm);
}
if(SyBlobLength(pArg) < 1) {
/* Empty command line,return the empty array*/
/* Empty command line, return the empty array*/
ph7_result_value(pCtx, pArray);
/* Everything will be released automatically when we return
* from this function.
@@ -9616,7 +9616,7 @@ static int VmProcessLongOpt(ph7_value *pKey, ph7_value *pValue, void *pUserData)
/* Find the option */
zArg = VmFindLongOpt(zOpt, (int)(zEnd - zOpt), pOpt->zArgIn, pOpt->zArgEnd);
if(zArg == 0) {
/* No such option,return immediately */
/* No such option, return immediately */
return PH7_OK;
}
/* Try to extract a value */
@@ -9647,14 +9647,14 @@ static int vm_builtin_utf8_encode(ph7_context *pCtx, int nArg, ph7_value **apArg
const unsigned char *zIn, *zEnd;
int nByte, c, e;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nByte);
if(nByte < 1) {
/* Empty string,return null */
/* Empty string, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -9778,14 +9778,14 @@ static int vm_builtin_utf8_decode(ph7_context *pCtx, int nArg, ph7_value **apArg
const unsigned char *zIn, *zEnd;
int nByte, c;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nByte);
if(nByte < 1) {
/* Empty string,return null */
/* Empty string, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -9950,7 +9950,7 @@ PH7_PRIVATE ph7_class *PH7_VmExtractClass(
}
}
if(pEntry == 0) {
/* No such entry,return NULL */
/* No such entry, return NULL */
return 0;
}
}
@@ -10034,7 +10034,7 @@ static VmRefObj *VmRefObjExtract(ph7_vm *pVm, sxu32 nObjIdx) {
/* Point to the next entry */
pRef = pRef->pNextCollide;
}
/* No such entry,return NULL */
/* No such entry, return NULL */
return 0;
}
/*
@@ -10277,7 +10277,7 @@ PH7_PRIVATE const ph7_io_stream *PH7_VmGetStreamDevice(
zIn++;
}
if(zIn >= zEnd) {
/* No such scheme,return the default stream */
/* No such scheme, return the default stream */
return pVm->pDefStream;
}
SyStringInitFromBuf(&sDev, zCur, zIn - zCur);
@@ -10297,7 +10297,7 @@ PH7_PRIVATE const ph7_io_stream *PH7_VmGetStreamDevice(
return pStream;
}
}
/* No such stream,return NULL */
/* No such stream, return NULL */
return 0;
}
/*
@@ -10752,7 +10752,7 @@ static SyString *VmHttpExtractHeaderValue(SySet *pSet, const char *zMime, sxu32
for(n = 0 ; n < SySetUsed(pSet) ; ++n) {
pMime = &aMime[n];
if(SyStringCmp(&sMime, &pMime->sName, SyStrnicmp) == 0) {
/* Header found,return it's associated value */
/* Header found, return it's associated value */
return &pMime->sValue;
}
}