make(1): rename Buf_Expand_1 to Buf_Expand

This commit is contained in:
rillig 2020-12-28 15:42:53 +00:00
parent a2efb39127
commit 76736a6e95
3 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: buf.c,v 1.45 2020/11/23 19:07:12 rillig Exp $ */
/* $NetBSD: buf.c,v 1.46 2020/12/28 15:42:53 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -69,17 +69,17 @@
* SUCH DAMAGE.
*/
/* Automatically-expanding null-terminated buffers. */
/* Automatically-expanding null-terminated character buffers. */
#include <limits.h>
#include "make.h"
/* "@(#)buf.c 8.1 (Berkeley) 6/6/93" */
MAKE_RCSID("$NetBSD: buf.c,v 1.45 2020/11/23 19:07:12 rillig Exp $");
MAKE_RCSID("$NetBSD: buf.c,v 1.46 2020/12/28 15:42:53 rillig Exp $");
/* Make space in the buffer for adding a single byte. */
/* Make space in the buffer for adding at least 16 more bytes. */
void
Buf_Expand_1(Buffer *buf)
Buf_Expand(Buffer *buf)
{
buf->cap += buf->cap > 16 ? buf->cap : 16;
buf->data = bmake_realloc(buf->data, buf->cap);

View File

@ -1,4 +1,4 @@
/* $NetBSD: buf.h,v 1.37 2020/12/06 11:00:56 rillig Exp $ */
/* $NetBSD: buf.h,v 1.38 2020/12/28 15:42:53 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -91,7 +91,7 @@ typedef struct Buffer {
#define __predict_false(x) (x)
#endif
void Buf_Expand_1(Buffer *);
void Buf_Expand(Buffer *);
/* Buf_AddByte adds a single byte to a buffer. */
MAKE_INLINE void
@ -100,7 +100,7 @@ Buf_AddByte(Buffer *buf, char byte)
size_t old_len = buf->len++;
char *end;
if (__predict_false(old_len + 1 >= buf->cap))
Buf_Expand_1(buf);
Buf_Expand(buf);
end = buf->data + old_len;
end[0] = byte;
end[1] = '\0';

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.522 2020/12/28 15:21:33 rillig Exp $ */
/* $NetBSD: parse.c,v 1.523 2020/12/28 15:42:53 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -109,7 +109,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: parse.c,v 1.522 2020/12/28 15:21:33 rillig Exp $");
MAKE_RCSID("$NetBSD: parse.c,v 1.523 2020/12/28 15:42:53 rillig Exp $");
/* types and constants */
@ -459,7 +459,7 @@ loadfile(const char *path, int fd)
Error("%s: file too large", path);
exit(2); /* Not 1 so -q can distinguish error */
}
Buf_Expand_1(&buf);
Buf_Expand(&buf);
}
assert(buf.len < buf.cap);
n = read(fd, buf.data + buf.len, buf.cap - buf.len);