Welcome to little lamb

Code » limb » commit 0b9da1c

Add siov_search()

author Olivier Brunel
2023-03-17 14:54:30 UTC
committer Olivier Brunel
2023-03-17 14:54:30 UTC
parent 0eba5eb56d57d89c8f67259f268277f27059bd80

Add siov_search()

Also define siovec_search() which seems to have been forgotten from
skalibs/siovec.h

doc/siovec.h.0.md +3 -0
include/limb/siovec.h +4 -0

diff --git a/doc/siovec.h.0.md b/doc/siovec.h.0.md
index 85410b4..f1d3955 100644
--- a/doc/siovec.h.0.md
+++ b/doc/siovec.h.0.md
@@ -51,6 +51,9 @@ The following functions/macros are defined :
 : [siov_bytein](3)
 :: Same as [siovec_bytein](3)
 
+: [siov_search](3)
+:: Same as [siovec_search](3)
+
 : [siov_seek_gather](3)
 :: Same as [siovec_seek_gather](3) but with destination as first arguments
 
diff --git a/include/limb/siovec.h b/include/limb/siovec.h
index fc33e5b..5721a1a 100644
--- a/include/limb/siovec.h
+++ b/include/limb/siovec.h
@@ -13,6 +13,9 @@ extern size_t siovec_seek_bytechr(const struct iovec *v, unsigned int n, size_t
 extern size_t siovec_seek_bytein(const struct iovec *v, unsigned int n, size_t offset,
                                  const char *sep, size_t len);
 
+/* from skalibs */
+extern size_t siovec_search(const struct iovec *v, unsigned int n, const char *str, size_t len);
+
 #define siov_len(v,n)                   siovec_len(v, n)
 #define siov_gather(dst,max,v,n)        siovec_gather(v, n, dst, max)
 #define siov_scatter(v,n,sce,len)       siovec_scatter(v, n, sce, len)
@@ -21,6 +24,7 @@ extern size_t siovec_seek_bytein(const struct iovec *v, unsigned int n, size_t o
 #define siov_trunc(v,n,l)               siovec_trunc(v, n, l)
 #define siov_bytechr(v,n,c)             siovec_bytechr(v, n, c)
 #define siov_bytein(v,n,s,l)            siovec_bytein(v, n, s, l)
+#define siov_search(v,n,s,l)            siovec_search(v, n, s, l)
 
 #define siov_seek_gather(dst,max,v,n,o) siovec_seek_gather(v, n, o, dst, max)
 #define siov_seek_bytechr(v,n,o,c)    siovec_seek_bytechr(v, n, o, c)