commit f36382f5b8ccd91c72f59b9d85149893dfc8f9a7
parent e8ee345fae915e7698cbb10d23d02ae0f6c94b81
Author: Remy Noulin <loader2x@gmail.com>
Date: Mon, 23 Dec 2019 07:49:57 +0100
return NULL in smallBool, smallDouble and smallInt when there is an error
To be consistent with all other functions.
src/json/libsheepyCSmallBool.c | 14 +++++++-------
src/json/libsheepyCSmallDouble.c | 14 +++++++-------
src/json/libsheepyCSmallInt.c | 14 +++++++-------
3 files changed, 21 insertions(+), 21 deletions(-)
Diffstat:
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/src/json/libsheepyCSmallBool.c b/src/json/libsheepyCSmallBool.c
@@ -416,7 +416,7 @@ internal smallBoolt* setSSmallBool(smallBoolt* self, const char* p2) {
bool value = false;;
if (!p2) {
- return(self);
+ return(NULL);
}
if (strEq(p2, "true") || strEq(p2, "TRUE")) {
@@ -436,7 +436,7 @@ internal smallBoolt* setSmallBoolSmallBool(smallBoolt* self, smallBoolt* p2) {
bool value = false;;
if (!p2) {
- return(self);
+ return(NULL);
}
value = p2->f->get(p2);
@@ -454,7 +454,7 @@ internal smallBoolt* setSmallDoubleSmallBool(smallBoolt* self, smallDoublet* p2)
bool value = false;;
if (!p2) {
- return(self);
+ return(NULL);
}
double r = p2->f->get(p2);
@@ -475,7 +475,7 @@ internal smallBoolt* setSmallIntSmallBool(smallBoolt* self, smallIntt* p2) {
bool value = false;;
if (!p2) {
- return(self);
+ return(NULL);
}
int64_t r = p2->f->get(p2);
@@ -495,13 +495,13 @@ internal smallBoolt* setSmallIntSmallBool(smallBoolt* self, smallIntt* p2) {
internal smallBoolt* setSmallJsonSmallBool(smallBoolt* self, smallJsont* p2) {
if (!p2) {
- return(self);
+ return(NULL);
}
const char *type = getTopTypeO(p2);
if (!type || eqS(type, "undefined") || eqS(type, "dict") || eqS(type, "array")) {
- return(self);
+ return(NULL);
}
if (eqS(type, "bool")) {
@@ -524,7 +524,7 @@ internal smallBoolt* setSmallStringSmallBool(smallBoolt* self, smallStringt* p2)
bool value = false;;
if (!p2) {
- return(self);
+ return(NULL);
}
if (equalSO(p2, "true") || equalSO(p2, "TRUE")) {
diff --git a/src/json/libsheepyCSmallDouble.c b/src/json/libsheepyCSmallDouble.c
@@ -388,7 +388,7 @@ internal smallDoublet* setUint64SmallDouble(smallDoublet* self, uint64_t p2) {
internal smallDoublet* setSSmallDouble(smallDoublet* self, const char* p2) {
if (!p2 || !isNumber(p2)) {
- return(self);
+ return(NULL);
}
if (!self->value) {
self->value = allocSDouble(parseDouble(p2));
@@ -403,7 +403,7 @@ internal smallDoublet* setSmallBoolSmallDouble(smallDoublet* self, smallBoolt* p
bool value;
if (!p2) {
- return(self);
+ return(NULL);
}
value = p2->f->get(p2);
@@ -420,7 +420,7 @@ internal smallDoublet* setSmallBoolSmallDouble(smallDoublet* self, smallBoolt* p
internal smallDoublet* setSmallDoubleSmallDouble(smallDoublet* self, smallDoublet* p2) {
if (!p2) {
- return(self);
+ return(NULL);
}
if (!self->value) {
@@ -435,7 +435,7 @@ internal smallDoublet* setSmallDoubleSmallDouble(smallDoublet* self, smallDouble
internal smallDoublet* setSmallIntSmallDouble(smallDoublet* self, smallIntt* p2) {
if (!p2) {
- return(self);
+ return(NULL);
}
if (!self->value) {
@@ -450,13 +450,13 @@ internal smallDoublet* setSmallIntSmallDouble(smallDoublet* self, smallIntt* p2)
internal smallDoublet* setSmallJsonSmallDouble(smallDoublet* self, smallJsont* p2) {
if (!p2) {
- return(self);
+ return(NULL);
}
const char *type = getTopTypeO(p2);
if (!type || eqS(type, "undefined") || eqS(type, "dict") || eqS(type, "array")) {
- return(self);
+ return(NULL);
}
if (eqS(type, "bool")) {
@@ -478,7 +478,7 @@ internal smallDoublet* setSmallJsonSmallDouble(smallDoublet* self, smallJsont* p
internal smallDoublet* setSmallStringSmallDouble(smallDoublet* self, smallStringt* p2) {
if (!p2 || !isNumberO(p2)) {
- return(self);
+ return(NULL);
}
if (!self->value) {
self->value = allocSDouble(parseDoubleO(p2));
diff --git a/src/json/libsheepyCSmallInt.c b/src/json/libsheepyCSmallInt.c
@@ -394,7 +394,7 @@ internal smallIntt* setUint64SmallInt(smallIntt* self, uint64_t p2) {
internal smallIntt* setSSmallInt(smallIntt* self, const char* p2) {
if (!p2 || !isNumber(p2)) {
- return(self);
+ return(NULL);
}
if (!self->value) {
self->value = allocSInt(parseInt(p2));
@@ -409,7 +409,7 @@ internal smallIntt* setSmallBoolSmallInt(smallIntt* self, smallBoolt* p2) {
bool value;
if (!p2) {
- return(self);
+ return(NULL);
}
value = p2->f->get(p2);
@@ -426,7 +426,7 @@ internal smallIntt* setSmallBoolSmallInt(smallIntt* self, smallBoolt* p2) {
internal smallIntt* setSmallDoubleSmallInt(smallIntt* self, smallDoublet* p2) {
if (!p2) {
- return(self);
+ return(NULL);
}
if (!self->value) {
@@ -441,7 +441,7 @@ internal smallIntt* setSmallDoubleSmallInt(smallIntt* self, smallDoublet* p2) {
internal smallIntt* setSmallIntSmallInt(smallIntt* self, smallIntt* p2) {
if (!p2) {
- return(self);
+ return(NULL);
}
if (!self->value) {
@@ -456,13 +456,13 @@ internal smallIntt* setSmallIntSmallInt(smallIntt* self, smallIntt* p2) {
internal smallIntt* setSmallJsonSmallInt(smallIntt* self, smallJsont* p2) {
if (!p2) {
- return(self);
+ return(NULL);
}
const char *type = getTopTypeO(p2);
if (!type || eqS(type, "undefined") || eqS(type, "dict") || eqS(type, "array")) {
- return(self);
+ return(NULL);
}
if (eqS(type, "bool")) {
@@ -484,7 +484,7 @@ internal smallIntt* setSmallJsonSmallInt(smallIntt* self, smallJsont* p2) {
internal smallIntt* setSmallStringSmallInt(smallIntt* self, smallStringt* p2) {
if (!p2 || !isNumberO(p2)) {
- return(self);
+ return(NULL);
}
if (!self->value) {
self->value = allocSInt(parseIntO(p2));