commit 425a21b652e2555980b9a2aa05a43bd86b2bc213
parent 6342cb9d82b7f87eb4d571f8f0d3216b62b29865
Author: Remy Noulin <loader2x@gmail.com>
Date: Mon, 23 Nov 2020 22:14:45 +0100
when the smallContainer class has a free function set, copy it to the sContainer when it is allocated to be able to the data when the container is an array, dict or json
release/libsheepy.c | 1 +
src/json/libsheepyCSmallContainer.c | 4 ++++
src/libsheepy.c | 1 +
3 files changed, 6 insertions(+)
Diffstat:
3 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/release/libsheepy.c b/release/libsheepy.c
@@ -1101,6 +1101,7 @@ void setLogStdout(bool state) {
/**
* log to a file named progName.log
+ * Use closeLogFiles when finished logging
*/
bool openProgLogFile(void) {
diff --git a/src/json/libsheepyCSmallContainer.c b/src/json/libsheepyCSmallContainer.c
@@ -320,7 +320,11 @@ internal smallContainert* setSmallContainer(smallContainert *self, void *data) {
if (!self->data) {
self->data = allocSContainer(data);
+ if (self->f->dataFree) {
+ // set free function from class
+ self->data->free = (freeSContainerFt)self->f->dataFree;
}
+ }
else {
self->data->data = data;
}
diff --git a/src/libsheepy.c b/src/libsheepy.c
@@ -1157,6 +1157,7 @@ void setLogStdout(bool state) {
/**
* log to a file named progName.log
+ * Use closeLogFiles when finished logging
*/
bool openProgLogFile(void) {