libsheepy

C lib for handling text files, strings and json like data structure with an object oriented system
git clone https://spartatek.se/git/libsheepy.git
Log | Files | Refs | README | LICENSE

commit e64b5cf4ca2cb7e6a30db882054b1781cd1e6306
parent 8b9b778ae8197e8a17af2edcc29965187b500c0a
Author: Remy Noulin <loader2x@gmail.com>
Date:   Wed,  9 Mar 2022 21:46:40 +0200

print empty char** list as [] instead of (null), print all error logs with logE to avoid stdout when it is disabled

release/libsheepy.c        | 4 ++--
release/libsheepy.h        | 2 +-
src/json/libsheepyObject.c | 6 ++++--
src/libsheepy.c            | 4 ++--
src/libsheepy.h            | 2 +-
5 files changed, 10 insertions(+), 8 deletions(-)

Diffstat:
Mrelease/libsheepy.c | 4++--
Mrelease/libsheepy.h | 2+-
Msrc/json/libsheepyObject.c | 6++++--
Msrc/libsheepy.c | 4++--
Msrc/libsheepy.h | 2+-
5 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/release/libsheepy.c b/release/libsheepy.c @@ -5922,7 +5922,7 @@ uint64_t randomWordFromHW(void) { // unitTest #endif #else - puts("HW Random generator not available on the ARM platform"); + logE("HW Random generator not available on the ARM platform"); return(0); // __arm__ || __aarch64__ || __i386__ #endif @@ -54256,7 +54256,7 @@ char **btrace(void) { // check that the symbols are found if (hasS(bts[0], "(+")) { - puts(BLD RED "No symbols found. Link the program with the '-rdynamic' option" RST); + logE(BLD RED "No symbols found. Link the program with the '-rdynamic' option" RST); free(bts); return(NULL); } diff --git a/release/libsheepy.h b/release/libsheepy.h @@ -98,7 +98,7 @@ // version accoring to the version package: Release.Major.minor.patch // https://noulin.net/version/file/README.md.html -#define LIBSHEEPY_VERSION "2.2.8.1" +#define LIBSHEEPY_VERSION "2.2.8.2" #ifndef SH_PREFIX #define SH_PREFIX(NAME) NAME diff --git a/src/json/libsheepyObject.c b/src/json/libsheepyObject.c @@ -1259,7 +1259,8 @@ char *toStringListSGF(char** object) { } char *s = join(object, "\",\""); if (!s) { - return(NULL); + // empty list + return(strdup("[]")); } char *r = catS("[\"", s, "\"]");; free(s); @@ -1273,7 +1274,8 @@ char *toStringListCSGF(const char** object) { } char *s = joinCS(object, "\",\""); if (!s) { - return(NULL); + // empty list + return(strdup("[]")); } char *r = catS("[\"", s, "\"]");; free(s); diff --git a/src/libsheepy.c b/src/libsheepy.c @@ -5978,7 +5978,7 @@ uint64_t randomWordFromHW(void) { // unitTest #endif #else - puts("HW Random generator not available on the ARM platform"); + logE("HW Random generator not available on the ARM platform"); return(0); // __arm__ || __aarch64__ || __i386__ #endif @@ -54312,7 +54312,7 @@ char **btrace(void) { // check that the symbols are found if (hasS(bts[0], "(+")) { - puts(BLD RED "No symbols found. Link the program with the '-rdynamic' option" RST); + logE(BLD RED "No symbols found. Link the program with the '-rdynamic' option" RST); free(bts); return(NULL); } diff --git a/src/libsheepy.h b/src/libsheepy.h @@ -98,7 +98,7 @@ // version accoring to the version package: Release.Major.minor.patch // https://noulin.net/version/file/README.md.html -#define LIBSHEEPY_VERSION "2.2.8.1" +#define LIBSHEEPY_VERSION "2.2.8.2" #ifndef SH_PREFIX #define SH_PREFIX(NAME) NAME