commit 3d5b7f6cc722398b3fbb1a8563bae9bed4449207
parent 642c24b1baca7dde1c16437ca21f27704245286f
Author: Remy Noulin <loader2x@gmail.com>
Date: Tue, 8 Jun 2021 14:16:10 +0200
fix logSystem print, the command is interpreted as a string (not a format string) add replaceSMax synonym for replaceS_max, update readme
logSystem("git log -n 2 --pretty=\"%ai\""); now prints correctly
README.md | 7 ++++---
example/README.template | 7 ++++---
release/libsheepy.h | 22 +++++++++++++++-------
src/libsheepy.c | 2 ++
src/libsheepy.h | 22 +++++++++++++++-------
5 files changed, 40 insertions(+), 20 deletions(-)
Diffstat:
5 files changed, 40 insertions(+), 20 deletions(-)
diff --git a/README.md b/README.md
@@ -12,7 +12,7 @@ libsheepy is C library for handling text files and strings.
Status: __libsheepy and libsheepyObject implemented__
-The API in libsheepy.h is stable and tested, libsheepyObject.h is stable but not yet completely tested.
+The API in libsheepy.h is stable and tested, libsheepyObject.h is stable and tested.
Current API is compatible with future version of libsheepy and will be changed only if a serious bug is found (rare).
The version number are x.Major.Minor.Patch and is updated like this:
@@ -65,9 +65,9 @@ libsheepy is NULL safe and any parameter can be NULL.
Check out the [user guide](http://spartatek.se/libsheepyUserGuide/) to learn how to use libsheepy and read the more detailed documentation at [http://spartatek.se/libsheepy/](http://spartatek.se/libsheepy/)
__Status__: (libsheepy.h and libsheepy.c)
-- Unit tests: 94% code coverage of the core functionality - 98% branch coverage (mainly malloc failures are not tested)
+- Unit tests: 97% code coverage of the core functionality - 98% branch coverage (mainly malloc failures are not tested)
- Valgrind - Memcheck: No memory leaks - 94% code coverage of the core functionality
-- Static analysis: cppcheck, clang static analyzer - pending result
+- Static analysis: done with cppcheck, clang static analyzer, gcc static analyzer, coverity, facebook infer
# Features
@@ -89,6 +89,7 @@ __Status__: (libsheepy.h and libsheepy.c)
- dictionary, json object, stringify and parsing
- thread pool
- UTF-8 string functions: length, makeValid...
+- json and yml parsers
# Compilation and install
diff --git a/example/README.template b/example/README.template
@@ -12,7 +12,7 @@ libsheepy is C library for handling text files and strings.
Status: __libsheepy and libsheepyObject implemented__
-The API in libsheepy.h is stable and tested, libsheepyObject.h is stable but not yet completely tested.
+The API in libsheepy.h is stable and tested, libsheepyObject.h is stable and tested.
Current API is compatible with future version of libsheepy and will be changed only if a serious bug is found (rare).
The version number are x.Major.Minor.Patch and is updated like this:
@@ -65,9 +65,9 @@ libsheepy is NULL safe and any parameter can be NULL.
Check out the [user guide](http://spartatek.se/libsheepyUserGuide/) to learn how to use libsheepy and read the more detailed documentation at [http://spartatek.se/libsheepy/](http://spartatek.se/libsheepy/)
__Status__: (libsheepy.h and libsheepy.c)
-- Unit tests: 94% code coverage of the core functionality - 98% branch coverage (mainly malloc failures are not tested)
+- Unit tests: 97% code coverage of the core functionality - 98% branch coverage (mainly malloc failures are not tested)
- Valgrind - Memcheck: No memory leaks - 94% code coverage of the core functionality
-- Static analysis: cppcheck, clang static analyzer - pending result
+- Static analysis: done with cppcheck, clang static analyzer, gcc static analyzer, coverity, facebook infer
# Features
@@ -89,6 +89,7 @@ __Status__: (libsheepy.h and libsheepy.c)
- dictionary, json object, stringify and parsing
- thread pool
- UTF-8 string functions: length, makeValid...
+- json and yml parsers
# Compilation and install
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.5.2"
+#define LIBSHEEPY_VERSION "2.2.5.3"
#ifndef SH_PREFIX
#define SH_PREFIX(NAME) NAME
@@ -1892,15 +1892,19 @@ char *replaceCharSS(const char *s, char olds, const char *news, size_t max);
char *replaceSCharS(const char *s, const char *olds, char news, size_t max);
char *replaceCharCharS(const char *s, char olds, char news, size_t max);
#define replaceS_max(s,olds,news) replaceS(s,olds,news, 0)
+#define replaceSMax replaceS_max
char* iReplaceS(char **s, const char *olds, const char *news, size_t max);
char* iReplaceCharSS(char **s, char olds, const char *news, size_t max);
char* iReplaceSCharS(char **s, const char *olds, char news, size_t max);
char* iReplaceCharCharS(char **s, char olds, char news, size_t max);
#define iReplaceS_max(s,olds,news) iReplaceS(s,olds,news, 0)
+#define iReplaceSMax iReplaceS_max
char* bReplaceS(char *s, const char *olds, const char *news, size_t max);
#define bReplaceS_max(s,olds,news) bReplaceS(s,olds,news, 0)
+#define bReplaceSMax bReplaceS_max
char* bLReplaceS(char *s, size_t sSize, const char *olds, const char *news, size_t max);
#define bLReplaceS_max(s,sSize,olds,news) bLReplaceS(s,sSize,olds,news, 0)
+#define bLReplaceSMax bLReplaceS_max
// string replace many olds with news (s, olds1, news1, olds2, news2,...)
char *replaceManySF(const char *paramType, ...);
@@ -1918,15 +1922,19 @@ char *icReplaceCharSS(const char *s, char olds, const char *news, size_t max);
char *icReplaceSCharS(const char *s, const char *olds, char news, size_t max);
char *icReplaceCharCharS(const char *s, char olds, char news, size_t max);
#define icReplaceS_max(s,olds,news) icReplaceS(s,olds,news, 0)
+#define icReplaceSMax icReplaceS_max
char* iicReplaceS(char **s, const char *olds, const char *news, size_t max);
char* iicReplaceCharSS(char **s, char olds, const char *news, size_t max);
char* iicReplaceSCharS(char **s, const char *olds, char news, size_t max);
char* iicReplaceCharCharS(char **s, char olds, char news, size_t max);
#define iicReplaceS_max(s,olds,news) iicReplaceS(s,olds,news, 0)
+#define iicReplaceSMax iicReplaceS_max
char* bicReplaceS(char *s, const char *olds, const char *news, size_t max);
#define bicReplaceS_max(s,olds,news) bicReplaceS(s,olds,news, 0)
+#define bicReplaceSMax bicReplaceS_max
char* bLicReplaceS(char *s, size_t sSize, const char *olds, const char *news, size_t max);
#define bLicReplaceS_max(s,sSize,olds,news) bLicReplaceS(s,sSize,olds,news, 0)
+#define bLicReplaceSMax bLicReplaceS_max
// string replace many olds with news (s, olds1, news1, olds2, news2,...)
char *icReplaceManySF(const char *paramType, ...);
@@ -2977,13 +2985,13 @@ int systemf(const char *fmt, ...);
// system commands and log
#define logSystem(cmd) do{\
var UNIQVAR(cm) = cmd;\
- logI (UNIQVAR(cm));\
- system(UNIQVAR(cm));\
+ logI("%s",UNIQVAR(cm));\
+ system (UNIQVAR(cm));\
} while(0)
#define logExec logSystem
#define logSystemOut(cmd) ({\
var UNIQVAR(cm) = cmd;\
- logI (UNIQVAR(cm));\
+ logI("%s",UNIQVAR(cm));\
systemOut(UNIQVAR(cm));\
})
#define logExecOut logSystemOut
@@ -3009,8 +3017,8 @@ int commandNFreeF(char *cmd, int line, const char *thisFunc, const char *thisFil
// log then run command and return exit code from command (not system return value like system, systemf and systemNFree)
#define logCommand(cmd) funcbegin\
var UNIQVAR(cm) = cmd;\
- logI (UNIQVAR(cm));\
- command(UNIQVAR(cm));\
+ logI("%s",UNIQVAR(cm));\
+ command (UNIQVAR(cm));\
funcend
#define logCommandf(fmt, ...) funcbegin\
@@ -3020,7 +3028,7 @@ int commandNFreeF(char *cmd, int line, const char *thisFunc, const char *thisFil
#define logCommandNFree(cmd) funcbegin\
var UNIQVAR(cm) = cmd;\
- logI (UNIQVAR(cm));\
+ logI ("%s",UNIQVAR(cm));\
commandNFree(UNIQVAR(cm));\
funcend
diff --git a/src/libsheepy.c b/src/libsheepy.c
@@ -55583,6 +55583,8 @@ int MAIN(int ARGC, char** ARGV) {
argc = ARGC; argv = ARGV;
typ struct {int a; int b;} structuret;;
+ logSystem("git log -n 2 --pretty=\"%ai\"");
+
sliceT(slStruct, structuret);
slStruct slc;
sliceInit(&slc);
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.5.2"
+#define LIBSHEEPY_VERSION "2.2.5.3"
#ifndef SH_PREFIX
#define SH_PREFIX(NAME) NAME
@@ -1892,15 +1892,19 @@ char *replaceCharSS(const char *s, char olds, const char *news, size_t max);
char *replaceSCharS(const char *s, const char *olds, char news, size_t max);
char *replaceCharCharS(const char *s, char olds, char news, size_t max);
#define replaceS_max(s,olds,news) replaceS(s,olds,news, 0)
+#define replaceSMax replaceS_max
char* iReplaceS(char **s, const char *olds, const char *news, size_t max);
char* iReplaceCharSS(char **s, char olds, const char *news, size_t max);
char* iReplaceSCharS(char **s, const char *olds, char news, size_t max);
char* iReplaceCharCharS(char **s, char olds, char news, size_t max);
#define iReplaceS_max(s,olds,news) iReplaceS(s,olds,news, 0)
+#define iReplaceSMax iReplaceS_max
char* bReplaceS(char *s, const char *olds, const char *news, size_t max);
#define bReplaceS_max(s,olds,news) bReplaceS(s,olds,news, 0)
+#define bReplaceSMax bReplaceS_max
char* bLReplaceS(char *s, size_t sSize, const char *olds, const char *news, size_t max);
#define bLReplaceS_max(s,sSize,olds,news) bLReplaceS(s,sSize,olds,news, 0)
+#define bLReplaceSMax bLReplaceS_max
// string replace many olds with news (s, olds1, news1, olds2, news2,...)
char *replaceManySF(const char *paramType, ...);
@@ -1918,15 +1922,19 @@ char *icReplaceCharSS(const char *s, char olds, const char *news, size_t max);
char *icReplaceSCharS(const char *s, const char *olds, char news, size_t max);
char *icReplaceCharCharS(const char *s, char olds, char news, size_t max);
#define icReplaceS_max(s,olds,news) icReplaceS(s,olds,news, 0)
+#define icReplaceSMax icReplaceS_max
char* iicReplaceS(char **s, const char *olds, const char *news, size_t max);
char* iicReplaceCharSS(char **s, char olds, const char *news, size_t max);
char* iicReplaceSCharS(char **s, const char *olds, char news, size_t max);
char* iicReplaceCharCharS(char **s, char olds, char news, size_t max);
#define iicReplaceS_max(s,olds,news) iicReplaceS(s,olds,news, 0)
+#define iicReplaceSMax iicReplaceS_max
char* bicReplaceS(char *s, const char *olds, const char *news, size_t max);
#define bicReplaceS_max(s,olds,news) bicReplaceS(s,olds,news, 0)
+#define bicReplaceSMax bicReplaceS_max
char* bLicReplaceS(char *s, size_t sSize, const char *olds, const char *news, size_t max);
#define bLicReplaceS_max(s,sSize,olds,news) bLicReplaceS(s,sSize,olds,news, 0)
+#define bLicReplaceSMax bLicReplaceS_max
// string replace many olds with news (s, olds1, news1, olds2, news2,...)
char *icReplaceManySF(const char *paramType, ...);
@@ -2977,13 +2985,13 @@ int systemf(const char *fmt, ...);
// system commands and log
#define logSystem(cmd) do{\
var UNIQVAR(cm) = cmd;\
- logI (UNIQVAR(cm));\
- system(UNIQVAR(cm));\
+ logI("%s",UNIQVAR(cm));\
+ system (UNIQVAR(cm));\
} while(0)
#define logExec logSystem
#define logSystemOut(cmd) ({\
var UNIQVAR(cm) = cmd;\
- logI (UNIQVAR(cm));\
+ logI("%s",UNIQVAR(cm));\
systemOut(UNIQVAR(cm));\
})
#define logExecOut logSystemOut
@@ -3009,8 +3017,8 @@ int commandNFreeF(char *cmd, int line, const char *thisFunc, const char *thisFil
// log then run command and return exit code from command (not system return value like system, systemf and systemNFree)
#define logCommand(cmd) funcbegin\
var UNIQVAR(cm) = cmd;\
- logI (UNIQVAR(cm));\
- command(UNIQVAR(cm));\
+ logI("%s",UNIQVAR(cm));\
+ command (UNIQVAR(cm));\
funcend
#define logCommandf(fmt, ...) funcbegin\
@@ -3020,7 +3028,7 @@ int commandNFreeF(char *cmd, int line, const char *thisFunc, const char *thisFil
#define logCommandNFree(cmd) funcbegin\
var UNIQVAR(cm) = cmd;\
- logI (UNIQVAR(cm));\
+ logI ("%s",UNIQVAR(cm));\
commandNFree(UNIQVAR(cm));\
funcend