From 4280d43e83deb0a9ed00ce362d3f01f273f24630 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 28 Oct 2022 23:13:15 +0000 Subject: Prepare for 2.12.1.0; add buffer_timed_put(s) Signed-off-by: Laurent Bercot --- src/libunixonacid/buffer_timed_put.c | 17 +++++++++++++++++ src/libunixonacid/buffer_timed_puts.c | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/libunixonacid/buffer_timed_put.c create mode 100644 src/libunixonacid/buffer_timed_puts.c (limited to 'src/libunixonacid') diff --git a/src/libunixonacid/buffer_timed_put.c b/src/libunixonacid/buffer_timed_put.c new file mode 100644 index 0000000..a645465 --- /dev/null +++ b/src/libunixonacid/buffer_timed_put.c @@ -0,0 +1,17 @@ +/* ISC license. */ + +#include + +#include +#include + +size_t buffer_timed_put (buffer *b, char const *s, size_t len, tain const *deadline, tain *stamp) +{ + size_t w = 0 ; + for (;;) + { + w += buffer_putnoflush(b, s + w, len - w) ; + if (w >= len || !buffer_timed_flush(b, deadline, stamp)) break ; + } + return w ; +} diff --git a/src/libunixonacid/buffer_timed_puts.c b/src/libunixonacid/buffer_timed_puts.c new file mode 100644 index 0000000..edc157a --- /dev/null +++ b/src/libunixonacid/buffer_timed_puts.c @@ -0,0 +1,10 @@ +/* ISC license. */ + +#include + +#include + +size_t buffer_timed_puts (buffer *b, char const *s, tain const *deadline, tain *stamp) +{ + return buffer_timed_put(b, s, strlen(s), deadline, stamp) ; +} -- cgit v1.2.3