summaryrefslogtreecommitdiff
path: root/src/libstddjb/stralloc_readyplus_tuned.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/stralloc_readyplus_tuned.c')
-rw-r--r--src/libstddjb/stralloc_readyplus_tuned.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstddjb/stralloc_readyplus_tuned.c b/src/libstddjb/stralloc_readyplus_tuned.c
new file mode 100644
index 0000000..f00813f
--- /dev/null
+++ b/src/libstddjb/stralloc_readyplus_tuned.c
@@ -0,0 +1,12 @@
+/* ISC license. */
+
+#include <errno.h>
+#include <skalibs/stralloc.h>
+
+int stralloc_readyplus_tuned (stralloc *sa, size_t n, size_t base, size_t a, size_t b)
+{
+ size_t newlen = sa->len + n ;
+ return newlen < sa->len ?
+ (errno = ERANGE, 0) :
+ stralloc_ready_tuned(sa, newlen, base, a, b) ;
+}