Mon Aug 31 16:42:10 2020 UTC ()
make(1): improve documentation for Buffer fields


(rillig)
diff -r1.26 -r1.27 src/usr.bin/make/buf.h

cvs diff -r1.26 -r1.27 src/usr.bin/make/buf.h (expand / switch to unified diff)

--- src/usr.bin/make/buf.h 2020/08/25 17:37:09 1.26
+++ src/usr.bin/make/buf.h 2020/08/31 16:42:10 1.27
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: buf.h,v 1.26 2020/08/25 17:37:09 rillig Exp $ */ 1/* $NetBSD: buf.h,v 1.27 2020/08/31 16:42:10 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * Adam de Boor. 7 * Adam de Boor.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -73,29 +73,29 @@ @@ -73,29 +73,29 @@
73 */ 73 */
74 74
75/*- 75/*-
76 * buf.h -- 76 * buf.h --
77 * Automatically growing null-terminated buffer of characters. 77 * Automatically growing null-terminated buffer of characters.
78 */ 78 */
79 79
80#ifndef MAKE_BUF_H 80#ifndef MAKE_BUF_H
81#define MAKE_BUF_H 81#define MAKE_BUF_H
82 82
83#include <stddef.h> 83#include <stddef.h>
84 84
85typedef struct Buffer { 85typedef struct Buffer {
86 size_t size; /* Current size of the buffer */ 86 size_t size; /* Allocated size of the buffer, including the null */
87 size_t count; /* Number of bytes in buffer */ 87 size_t count; /* Number of bytes in buffer, excluding the null */
88 char *buffer; /* The buffer itself (zero terminated) */ 88 char *buffer; /* The buffer itself (null-terminated) */
89} Buffer; 89} Buffer;
90 90
91/* If we aren't on NetBSD, __predict_false() might not be defined. */ 91/* If we aren't on NetBSD, __predict_false() might not be defined. */
92#ifndef __predict_false 92#ifndef __predict_false
93#define __predict_false(x) (x) 93#define __predict_false(x) (x)
94#endif 94#endif
95 95
96void Buf_Expand_1(Buffer *); 96void Buf_Expand_1(Buffer *);
97 97
98/* Buf_AddByte adds a single byte to a buffer. */ 98/* Buf_AddByte adds a single byte to a buffer. */
99static inline void MAKE_ATTR_UNUSED 99static inline void MAKE_ATTR_UNUSED
100Buf_AddByte(Buffer *bp, char byte) 100Buf_AddByte(Buffer *bp, char byte)
101{ 101{