summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/open_memstream.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 16:48:51 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 16:48:51 +0000
commitaea60bee5e9bad0aab62f480f19c2fb34c068de4 (patch)
tree1e7befbc10e28796528939427d4fdbd94b60d9af /lib/libc/stdio/open_memstream.c
parentMore evil bootstrap code. #ifndef ALIGNBYTES #define ALIGNBYTES 3. (diff)
downloadwireguard-openbsd-aea60bee5e9bad0aab62f480f19c2fb34c068de4.tar.xz
wireguard-openbsd-aea60bee5e9bad0aab62f480f19c2fb34c068de4.zip
Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther
Diffstat (limited to 'lib/libc/stdio/open_memstream.c')
-rw-r--r--lib/libc/stdio/open_memstream.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/stdio/open_memstream.c b/lib/libc/stdio/open_memstream.c
index 46105358d33..4ab9bc51e1d 100644
--- a/lib/libc/stdio/open_memstream.c
+++ b/lib/libc/stdio/open_memstream.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: open_memstream.c,v 1.3 2013/04/03 03:11:53 guenther Exp $ */
+/* $OpenBSD: open_memstream.c,v 1.4 2015/01/16 16:48:51 deraadt Exp $ */
/*
* Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
@@ -16,8 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
-
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
@@ -26,6 +24,8 @@
#include <string.h>
#include "local.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
struct state {
char *string; /* actual stream */
char **pbuf; /* point to the stream */
@@ -95,7 +95,7 @@ memstream_seek(void *v, fpos_t off, int whence)
}
st->pos = base + off;
- *st->psize = MIN(st->pos, st->len);
+ *st->psize = MINIMUM(st->pos, st->len);
return (st->pos);
}