commit 6b620a62fe733efb1d2de239ceed041ed2d6c5a8
parent 3e891c9fb6557d3dbc315660170f76bee8c1bfe2
Author: Remy Noulin <loader2x@gmail.com>
Date: Tue, 17 Jun 2025 12:58:29 +0200
add findCharB, fix issue in setG when setting void* in a smallBytes object
release/libsheepy.h | 2 +-
release/libsheepyBt.c | 7 +++++++
release/libsheepyBt.h | 4 +++-
release/libsheepyObject.h | 3 ++-
src/libsheepy.h | 2 +-
src/libsheepyBt.c | 7 +++++++
src/libsheepyBt.h | 4 +++-
src/libsheepyObject.h | 3 ++-
8 files changed, 26 insertions(+), 6 deletions(-)
Diffstat:
8 files changed, 26 insertions(+), 6 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.1"
+#define LIBSHEEPY_VERSION "2.2.20"
#ifndef SH_PREFIX
#define SH_PREFIX(NAME) NAME
diff --git a/release/libsheepyBt.c b/release/libsheepyBt.c
@@ -718,6 +718,13 @@ int writeFileB(const char *filePath, btt b) {
return writeFile(filePath, b.b, b.len);
}
+int64_t findCharB(btt b, const char *needle) {
+ if (!b.b or !needle ) ret -1;
+ u8 *p = memmem(b.b, b.len, needle, strlen(needle));
+ if (!p) ret -1;
+ ret (int64_t)(p - b.b);
+}
+
/**
* split b in vb static vector
* the vector is not reallocated
diff --git a/release/libsheepyBt.h b/release/libsheepyBt.h
@@ -391,7 +391,7 @@ btt *setValB(btt *b, btt *a);
// ..slice
// ..trim
// countB
-// findB
+// findB ..findCharB
// formatB
// iFormatB
// bFormatB
@@ -614,6 +614,8 @@ btt *bDelElemB(btt *string, int64_t index);
btt readFileB(const char *filePath) MUST_CHECK;
int writeFileB(const char *filePath, btt b) MUST_CHECK;
+int64_t findCharB(btt b, const char *needle);
+
// split b in vb static vector
// the vector is not reallocated
vbtt *sasplitB(vbtt *vb, const btt b, const btt delim);
diff --git a/release/libsheepyObject.h b/release/libsheepyObject.h
@@ -1188,7 +1188,8 @@ void finishManyOF(void *paramType, ...);
smallStringt*: setAtSmallStringSmallJsonG, \
smallContainert*: setAtSmallContainerSmallJsonG, \
undefinedt*: setAtUndefinedSmallJsonG, \
- default: setAtVoidSmallJsonG) \
+ default: setAtVoidSmallJsonG), \
+ default: setVoidSmallJsonG \
), \
smallStringt*: setAtSmallStringG, \
char *: setS, \
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.1"
+#define LIBSHEEPY_VERSION "2.2.20"
#ifndef SH_PREFIX
#define SH_PREFIX(NAME) NAME
diff --git a/src/libsheepyBt.c b/src/libsheepyBt.c
@@ -718,6 +718,13 @@ int writeFileB(const char *filePath, btt b) {
return writeFile(filePath, b.b, b.len);
}
+int64_t findCharB(btt b, const char *needle) {
+ if (!b.b or !needle ) ret -1;
+ u8 *p = memmem(b.b, b.len, needle, strlen(needle));
+ if (!p) ret -1;
+ ret (int64_t)(p - b.b);
+}
+
/**
* split b in vb static vector
* the vector is not reallocated
diff --git a/src/libsheepyBt.h b/src/libsheepyBt.h
@@ -391,7 +391,7 @@ btt *setValB(btt *b, btt *a);
// ..slice
// ..trim
// countB
-// findB
+// findB ..findCharB
// formatB
// iFormatB
// bFormatB
@@ -614,6 +614,8 @@ btt *bDelElemB(btt *string, int64_t index);
btt readFileB(const char *filePath) MUST_CHECK;
int writeFileB(const char *filePath, btt b) MUST_CHECK;
+int64_t findCharB(btt b, const char *needle);
+
// split b in vb static vector
// the vector is not reallocated
vbtt *sasplitB(vbtt *vb, const btt b, const btt delim);
diff --git a/src/libsheepyObject.h b/src/libsheepyObject.h
@@ -1188,7 +1188,8 @@ void finishManyOF(void *paramType, ...);
smallStringt*: setAtSmallStringSmallJsonG, \
smallContainert*: setAtSmallContainerSmallJsonG, \
undefinedt*: setAtUndefinedSmallJsonG, \
- default: setAtVoidSmallJsonG) \
+ default: setAtVoidSmallJsonG), \
+ default: setVoidSmallJsonG \
), \
smallStringt*: setAtSmallStringG, \
char *: setS, \