Do not use NULL if possible.
All checks were successful
The build was successful.

This commit is contained in:
2019-03-22 19:53:12 +01:00
parent 9d7a542aea
commit ff6c71db1c
4 changed files with 5 additions and 23 deletions

View File

@@ -151,7 +151,7 @@ static sxi32 VmJsonEncode(
ph7_context *pCtx = pData->pCtx;
int iFlags = pData->iFlags;
int nByte;
if(ph7_value_is_null(pIn) || ph7_value_is_resource(pIn)) {
if(ph7_value_is_void(pIn) || ph7_value_is_resource(pIn)) {
/* null */
ph7_result_string(pCtx, "null", (int)sizeof("null") - 1);
} else if(ph7_value_is_bool(pIn)) {
@@ -620,7 +620,7 @@ static sxi32 VmJsonDecode(
/* Reflect the JSON image */
if(pDecoder->pIn->nType & JSON_TK_NULL) {
/* Nullify the value.*/
ph7_value_null(pWorker);
ph7_value_void(pWorker);
} else if(pDecoder->pIn->nType & (JSON_TK_TRUE | JSON_TK_FALSE)) {
/* Boolean value */
ph7_value_bool(pWorker, (pDecoder->pIn->nType & JSON_TK_TRUE) ? 1 : 0);