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 3e891c9fb6557d3dbc315660170f76bee8c1bfe2
parent a54890e3f82bd8918da03e4af42fd88b2250db43
Author: Remy Noulin <loader2x@gmail.com>
Date:   Tue, 20 May 2025 10:13:40 +0200

allocate correct size in copyB

release/libsheepy.h   | 2 +-
release/libsheepyBt.c | 2 +-
src/libsheepy.h       | 2 +-
src/libsheepyBt.c     | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

Diffstat:
Mrelease/libsheepy.h | 2+-
Mrelease/libsheepyBt.c | 2+-
Msrc/libsheepy.h | 2+-
Msrc/libsheepyBt.c | 2+-
4 files changed, 4 insertions(+), 4 deletions(-)

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.19" +#define LIBSHEEPY_VERSION "2.2.19.1" #ifndef SH_PREFIX #define SH_PREFIX(NAME) NAME diff --git a/release/libsheepyBt.c b/release/libsheepyBt.c @@ -139,8 +139,8 @@ btt *allocPB(const btt *b) { */ btt copyB(const btt b) { btt r = b; - r.b = malloc(b.len); r.alloc = b.len ? b.len : 4 /*allocate 4 bytes when len is 0*/; + r.b = malloc(r.alloc); memcpy(r.b, b.b, b.len); ret r; } 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.19" +#define LIBSHEEPY_VERSION "2.2.19.1" #ifndef SH_PREFIX #define SH_PREFIX(NAME) NAME diff --git a/src/libsheepyBt.c b/src/libsheepyBt.c @@ -139,8 +139,8 @@ btt *allocPB(const btt *b) { */ btt copyB(const btt b) { btt r = b; - r.b = malloc(b.len); r.alloc = b.len ? b.len : 4 /*allocate 4 bytes when len is 0*/; + r.b = malloc(r.alloc); memcpy(r.b, b.b, b.len); ret r; }