diff options
| author | rillig <rillig@NetBSD.org> | 2020-08-23 06:12:52 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2020-08-23 06:12:52 +0000 |
| commit | 63008c6ac78af4c092aef119e12e34a79ebb718e (patch) | |
| tree | 2e938d6ea430936f9aac75df5d6fcd3045cd9ff0 /usr.bin/make/buf.c | |
| parent | 88debce1a2ea0a7c0958a8b5bab4371a9a9e8ee5 (diff) | |
make(1): use common MAX macro instead of self-defined
Diffstat (limited to 'usr.bin/make/buf.c')
| -rw-r--r-- | usr.bin/make/buf.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c index b24ec68df2b..052feadeebc 100644 --- a/usr.bin/make/buf.c +++ b/usr.bin/make/buf.c @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $ */ +/* $NetBSD: buf.c,v 1.36 2020/08/23 06:12:52 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.36 2020/08/23 06:12:52 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $"); +__RCSID("$NetBSD: buf.c,v 1.36 2020/08/23 06:12:52 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -86,19 +86,12 @@ __RCSID("$NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $"); #include <limits.h> #include "make.h" -#include "buf.h" - -#ifndef max -#define max(a, b) ((a) > (b) ? (a) : (b)) -#endif - -#define BUF_DEF_SIZE 256 /* Default buffer size */ /* Extend the buffer for adding a single byte. */ void Buf_Expand_1(Buffer *bp) { - bp->size += max(bp->size, 16); + bp->size += MAX(bp->size, 16); bp->buffer = bmake_realloc(bp->buffer, bp->size); } @@ -110,7 +103,7 @@ Buf_AddBytes(Buffer *bp, const char *bytesPtr, size_t numBytes) char *ptr; if (__predict_false(count + numBytes >= bp->size)) { - bp->size += max(bp->size, numBytes + 16); + bp->size += MAX(bp->size, numBytes + 16); bp->buffer = bmake_realloc(bp->buffer, bp->size); } @@ -181,7 +174,7 @@ void Buf_Init(Buffer *bp, size_t size) { if (size <= 0) { - size = BUF_DEF_SIZE; + size = 256; } bp->size = size; bp->count = 0; |
