From 43abcec0a21bb1d865a1e7c6d0c04d281524e9d8 Mon Sep 17 00:00:00 2001 From: Charles Longeau Date: Sun, 7 Oct 2012 15:46:39 +0000 Subject: convert iobuf_queue()'s to iobuf_fqueue(). (idea from gilles@) introduce iobuf_xinit() and iobuf_xfqueue(). (idea from eric@) ok gilles@ --- usr.sbin/smtpd/util.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'usr.sbin/smtpd/util.c') 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, ...) { -- cgit v1.2.3