summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-06-02 14:08:00 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-06-02 14:08:00 +0000
commiteffe4db8a69d475ae77bb7bf85bf53c009445d0e (patch)
treef5b499449afe0a37f96cf7f614199766d1ebef50
parentf476227930793f94e6ca9bd268b76bbf5c4f29c3 (diff)
downloadskalibs-effe4db8a69d475ae77bb7bf85bf53c009445d0e.tar.xz
Turn non-linear buffer macros calling str_len() into functions. >.>
-rw-r--r--package/deps.mak6
-rw-r--r--src/include/skalibs/buffer.h12
-rw-r--r--src/libstddjb/buffer_puts.c9
-rw-r--r--src/libstddjb/buffer_putsall.c9
-rw-r--r--src/libstddjb/buffer_putsallflush.c9
-rw-r--r--src/libstddjb/buffer_putsallnoflush.c9
-rw-r--r--src/libstddjb/buffer_putsflush.c9
-rw-r--r--src/libstddjb/buffer_putsnoflush.c9
8 files changed, 66 insertions, 6 deletions
diff --git a/package/deps.mak b/package/deps.mak
index d787b00..8f1d960 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -246,6 +246,12 @@ src/libstddjb/buffer_put.o src/libstddjb/buffer_put.lo: src/libstddjb/buffer_put
src/libstddjb/buffer_putall.o src/libstddjb/buffer_putall.lo: src/libstddjb/buffer_putall.c src/include/skalibs/buffer.h
src/libstddjb/buffer_putallnf.o src/libstddjb/buffer_putallnf.lo: src/libstddjb/buffer_putallnf.c src/include/skalibs/buffer.h
src/libstddjb/buffer_putflush.o src/libstddjb/buffer_putflush.lo: src/libstddjb/buffer_putflush.c src/include/skalibs/buffer.h
+src/libstddjb/buffer_puts.o src/libstddjb/buffer_puts.lo: src/libstddjb/buffer_puts.c src/include/skalibs/buffer.h src/include/skalibs/bytestr.h
+src/libstddjb/buffer_putsall.o src/libstddjb/buffer_putsall.lo: src/libstddjb/buffer_putsall.c src/include/skalibs/buffer.h src/include/skalibs/bytestr.h
+src/libstddjb/buffer_putsallflush.o src/libstddjb/buffer_putsallflush.lo: src/libstddjb/buffer_putsallflush.c src/include/skalibs/buffer.h src/include/skalibs/bytestr.h
+src/libstddjb/buffer_putsallnoflush.o src/libstddjb/buffer_putsallnoflush.lo: src/libstddjb/buffer_putsallnoflush.c src/include/skalibs/buffer.h src/include/skalibs/bytestr.h
+src/libstddjb/buffer_putsflush.o src/libstddjb/buffer_putsflush.lo: src/libstddjb/buffer_putsflush.c src/include/skalibs/buffer.h src/include/skalibs/bytestr.h
+src/libstddjb/buffer_putsnoflush.o src/libstddjb/buffer_putsnoflush.lo: src/libstddjb/buffer_putsnoflush.c src/include/skalibs/buffer.h src/include/skalibs/bytestr.h
src/libstddjb/buffer_putv.o src/libstddjb/buffer_putv.lo: src/libstddjb/buffer_putv.c src/include/skalibs/buffer.h src/include/skalibs/siovec.h
src/libstddjb/buffer_putvall.o src/libstddjb/buffer_putvall.lo: src/libstddjb/buffer_putvall.c src/include/skalibs/buffer.h src/include/skalibs/siovec.h
src/libstddjb/buffer_putvallnf.o src/libstddjb/buffer_putvallnf.lo: src/libstddjb/buffer_putvallnf.c src/include/skalibs/buffer.h
diff --git a/src/include/skalibs/buffer.h b/src/include/skalibs/buffer.h
index 7397b6e..0c7866a 100644
--- a/src/include/skalibs/buffer.h
+++ b/src/include/skalibs/buffer.h
@@ -41,27 +41,27 @@ extern int buffer_flush (buffer *) ;
#define buffer_putnoflush(b, s, len) cbuffer_put(&(b)->c, s, len)
#define buffer_putvnoflush(b, v, n) cbuffer_putv(&(b)->c, v, n)
-#define buffer_putsnoflush(b, s) buffer_putnoflush(b, (s), str_len(s))
+extern int buffer_putsnoflush (buffer *, char const *) ;
extern int buffer_putallnoflush (buffer *, char const *, unsigned int) ;
extern int buffer_putvallnoflush (buffer *, siovec_t const *, unsigned int) ;
-#define buffer_putsallnoflush(b, s) buffer_putallnoflush(b, (s), str_len(s))
+extern int buffer_putsallnoflush (buffer *, char const *) ;
extern int buffer_putall (buffer *, char const *, unsigned int, unsigned int *) ;
extern int buffer_putvall (buffer *, siovec_t const *, unsigned int, unsigned int *) ;
-#define buffer_putsall(b, s, w) buffer_putall(b, s, str_len(s), w)
+extern int buffer_putsall (buffer *, char const *, unsigned int *) ;
#define buffer_putallflush(b, s, len, w) (buffer_putall(b, s, len, w) && buffer_flush(b))
#define buffer_putvallflush(b, v, n, w) (buffer_putvall(b, v, n, w) && buffer_flush(b))
-#define buffer_putsallflush(b, s, w) buffer_putallflush(b, s, str_len(s), w)
+extern int buffer_putsallflush (buffer *, char const *, unsigned int *) ;
extern int buffer_put (buffer *, char const *, unsigned int) ;
extern int buffer_putv (buffer *, siovec_t const *, unsigned int) ;
-#define buffer_puts(b, s) buffer_put(b, (s), str_len(s))
+extern int buffer_puts (buffer *, char const *) ;
extern int buffer_putflush (buffer *, char const *, unsigned int) ;
extern int buffer_putvflush (buffer *, siovec_t const *, unsigned int) ;
-#define buffer_putsflush(b, s) buffer_putflush(b, (s), str_len(s))
+extern int buffer_putsflush (buffer *, char const *) ;
#define buffer_unput(b, n) cbuffer_unput(&(b)->c, n)
#define buffer_wpeek(b, v) cbuffer_wpeek(&(b)->c, v)
diff --git a/src/libstddjb/buffer_puts.c b/src/libstddjb/buffer_puts.c
new file mode 100644
index 0000000..aaaac2e
--- /dev/null
+++ b/src/libstddjb/buffer_puts.c
@@ -0,0 +1,9 @@
+/* ISC license. */
+
+#include <skalibs/bytestr.h>
+#include <skalibs/buffer.h>
+
+int buffer_puts (buffer *b, char const *s)
+{
+ return buffer_put(b, s, str_len(s)) ;
+}
diff --git a/src/libstddjb/buffer_putsall.c b/src/libstddjb/buffer_putsall.c
new file mode 100644
index 0000000..dbd306c
--- /dev/null
+++ b/src/libstddjb/buffer_putsall.c
@@ -0,0 +1,9 @@
+/* ISC license. */
+
+#include <skalibs/bytestr.h>
+#include <skalibs/buffer.h>
+
+int buffer_putsall (buffer *b, char const *s, unsigned int *w)
+{
+ return buffer_putall(b, s, str_len(s), w) ;
+}
diff --git a/src/libstddjb/buffer_putsallflush.c b/src/libstddjb/buffer_putsallflush.c
new file mode 100644
index 0000000..fa4c98c
--- /dev/null
+++ b/src/libstddjb/buffer_putsallflush.c
@@ -0,0 +1,9 @@
+/* ISC license. */
+
+#include <skalibs/bytestr.h>
+#include <skalibs/buffer.h>
+
+int buffer_putsallflush (buffer *b, char const *s, unsigned int *w)
+{
+ return buffer_putallflush(b, s, str_len(s), w) ;
+}
diff --git a/src/libstddjb/buffer_putsallnoflush.c b/src/libstddjb/buffer_putsallnoflush.c
new file mode 100644
index 0000000..0056cb4
--- /dev/null
+++ b/src/libstddjb/buffer_putsallnoflush.c
@@ -0,0 +1,9 @@
+/* ISC license. */
+
+#include <skalibs/bytestr.h>
+#include <skalibs/buffer.h>
+
+int buffer_putsallnoflush (buffer *b, char const *s)
+{
+ return buffer_putallnoflush(b, s, str_len(s)) ;
+}
diff --git a/src/libstddjb/buffer_putsflush.c b/src/libstddjb/buffer_putsflush.c
new file mode 100644
index 0000000..4be4c34
--- /dev/null
+++ b/src/libstddjb/buffer_putsflush.c
@@ -0,0 +1,9 @@
+/* ISC license. */
+
+#include <skalibs/bytestr.h>
+#include <skalibs/buffer.h>
+
+int buffer_putsflush (buffer *b, char const *s)
+{
+ return buffer_putflush(b, s, str_len(s)) ;
+}
diff --git a/src/libstddjb/buffer_putsnoflush.c b/src/libstddjb/buffer_putsnoflush.c
new file mode 100644
index 0000000..ad6b372
--- /dev/null
+++ b/src/libstddjb/buffer_putsnoflush.c
@@ -0,0 +1,9 @@
+/* ISC license. */
+
+#include <skalibs/bytestr.h>
+#include <skalibs/buffer.h>
+
+int buffer_putsnoflush (buffer *b, char const *s)
+{
+ return buffer_putnoflush(b, s, str_len(s)) ;
+}