Changeset 24 in kBuild for branches/FREEBSD/src/kmk/buf.c
- Timestamp:
- Nov 26, 2002 9:24:54 PM (22 years ago)
- File:
-
- 1 edited
-
branches/FREEBSD/src/kmk/buf.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/FREEBSD/src/kmk/buf.c
r10 r24 1 1 /* 2 * Copyright (c) 1988, 1989, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 2 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 4 3 * Copyright (c) 1988, 1989 by Adam de Boor 5 4 * Copyright (c) 1989 by Berkeley Softworks … … 36 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 36 * SUCH DAMAGE. 38 * 39 * @(#)buf.c 8.1 (Berkeley) 6/6/93 40 */ 41 42 #include <sys/cdefs.h> 43 __FBSDID("$FreeBSD: src/usr.bin/make/buf.c,v 1.18 2002/10/09 03:42:09 jmallett Exp $"); 37 */ 38 39 #ifndef lint 40 #if 0 41 static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93"; 42 #else 43 static const char rcsid[] = 44 "$FreeBSD: src/usr.bin/make/buf.c,v 1.11 1999/09/11 13:08:01 hoek Exp $"; 45 #endif 46 #endif /* not lint */ 44 47 45 48 /*- … … 53 56 54 57 #ifndef max 55 #define max(a,b) ((a) > (b) ? (a) : (b))58 #define max(a,b) ((a) > (b) ? (a) : (b)) 56 59 #endif 57 60 … … 63 66 * buffer in case it holds a string. 64 67 */ 65 #define BufExpand(bp,nb) \68 #define BufExpand(bp,nb) \ 66 69 if (bp->left < (nb)+1) {\ 67 70 int newSize = (bp)->size + max((nb)+1,BUF_ADD_INC); \ … … 75 78 } 76 79 77 #define BUF_DEF_SIZE 256 /* Default buffer size */78 #define BUF_ADD_INC 256 /* Expansion increment when Adding */79 #define BUF_UNGET_INC 16 /* Expansion increment when Ungetting */80 #define BUF_DEF_SIZE 256 /* Default buffer size */ 81 #define BUF_ADD_INC 256 /* Expansion increment when Adding */ 82 #define BUF_UNGET_INC 16 /* Expansion increment when Ungetting */ 80 83 81 84 /*- … … 93 96 */ 94 97 void 95 Buf_OvAddByte (Buffer bp, int byte) 96 { 98 Buf_OvAddByte (bp, byte) 99 register Buffer bp; 100 int byte; 101 { 102 int nbytes = 1; 97 103 bp->left = 0; 98 BufExpand (bp, 1);104 BufExpand (bp, nbytes); 99 105 100 106 *bp->inPtr++ = byte; … … 122 128 */ 123 129 void 124 Buf_AddBytes (Buffer bp, int numBytes, const Byte *bytesPtr) 130 Buf_AddBytes (bp, numBytes, bytesPtr) 131 register Buffer bp; 132 int numBytes; 133 const Byte *bytesPtr; 125 134 { 126 135 … … 152 161 */ 153 162 void 154 Buf_UngetByte (Buffer bp, int byte) 163 Buf_UngetByte (bp, byte) 164 register Buffer bp; 165 int byte; 155 166 { 156 167 … … 201 212 */ 202 213 void 203 Buf_UngetBytes (Buffer bp, int numBytes, Byte *bytesPtr) 214 Buf_UngetBytes (bp, numBytes, bytesPtr) 215 register Buffer bp; 216 int numBytes; 217 Byte *bytesPtr; 204 218 { 205 219 … … 244 258 */ 245 259 int 246 Buf_GetByte (Buffer bp) 260 Buf_GetByte (bp) 261 register Buffer bp; 247 262 { 248 263 int res; … … 277 292 */ 278 293 int 279 Buf_GetBytes (Buffer bp, int numBytes, Byte *bytesPtr) 294 Buf_GetBytes (bp, numBytes, bytesPtr) 295 register Buffer bp; 296 int numBytes; 297 Byte *bytesPtr; 280 298 { 281 299 … … 309 327 */ 310 328 Byte * 311 Buf_GetAll (Buffer bp, int *numBytesPtr) 329 Buf_GetAll (bp, numBytesPtr) 330 register Buffer bp; 331 int *numBytesPtr; 312 332 { 313 333 … … 334 354 */ 335 355 void 336 Buf_Discard (Buffer bp, int numBytes) 356 Buf_Discard (bp, numBytes) 357 register Buffer bp; 358 int numBytes; 337 359 { 338 360 … … 362 384 */ 363 385 int 364 Buf_Size (Buffer buf) 386 Buf_Size (buf) 387 Buffer buf; 365 388 { 366 389 return (buf->inPtr - buf->outPtr); … … 384 407 */ 385 408 Buffer 386 Buf_Init (int size) 409 Buf_Init (size) 410 int size; /* Initial size for the buffer */ 387 411 { 388 412 Buffer bp; /* New Buffer */ … … 405 429 *----------------------------------------------------------------------- 406 430 * Buf_Destroy -- 407 * Destroy a buffer, and optionally free its data, too.431 * Nuke a buffer and all its resources. 408 432 * 409 433 * Results: … … 416 440 */ 417 441 void 418 Buf_Destroy (Buffer buf, Boolean freeData) 442 Buf_Destroy (buf, freeData) 443 Buffer buf; /* Buffer to destroy */ 444 Boolean freeData; /* TRUE if the data should be destroyed as well */ 419 445 { 420 446 … … 441 467 */ 442 468 void 443 Buf_ReplaceLastByte (Buffer buf, int byte) 469 Buf_ReplaceLastByte (buf, byte) 470 Buffer buf; /* buffer to augment */ 471 int byte; /* byte to be written */ 444 472 { 445 473 if (buf->inPtr == buf->outPtr)
Note:
See TracChangeset
for help on using the changeset viewer.

