summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/util.c
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2012-10-07 15:46:39 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2012-10-07 15:46:39 +0000
commit43abcec0a21bb1d865a1e7c6d0c04d281524e9d8 (patch)
tree8b68b08554e92c81e9ae617bec20d522152a089f /usr.sbin/smtpd/util.c
parentbae56aedac673933f7ee13d3b728a058bca35a43 (diff)
convert iobuf_queue()'s to iobuf_fqueue(). (idea from gilles@)
introduce iobuf_xinit() and iobuf_xfqueue(). (idea from eric@) ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/util.c')
-rw-r--r--usr.sbin/smtpd/util.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index bfd9bd15515..54e1d575df0 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.85 2012/10/04 12:17:09 todd Exp $ */
+/* $OpenBSD: util.c,v 1.86 2012/10/07 15:46:38 chl Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -101,6 +101,29 @@ xmemdup(const void *ptr, size_t size, const char *where)
return (r);
}
+#if !defined(NO_IO)
+void
+iobuf_xinit(struct iobuf *io, size_t size, size_t max, const char *where)
+{
+ if (iobuf_init(io, size, max) == -1)
+ errx(1, "%s: iobuf_init(%p, %zu, %zu)", where, io, size, max);
+}
+
+void
+iobuf_xfqueue(struct iobuf *io, const char *where, const char *fmt, ...)
+{
+ va_list ap;
+ int len;
+
+ va_start(ap, fmt);
+ len = iobuf_vfqueue(io, fmt, ap);
+ va_end(ap);
+
+ if (len == -1)
+ errx(1, "%s: iobuf_xfqueue(%p, %s, ...)", where, io, fmt);
+}
+#endif
+
int
bsnprintf(char *str, size_t size, const char *format, ...)
{