summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/buf.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-02-04 13:34:16 +0000
committerharti <harti@FreeBSD.org>2005-02-04 13:34:16 +0000
commit6861248dfcd7d5c6641f437335516c106f83df33 (patch)
tree8f4d2441bdfa94ac38f4f284b8ac56d81e8a6fb3 /usr.bin/make/buf.c
parent7403bf4c90000b970a2aa9da9e5c116a4aac5bb8 (diff)
downloadFreeBSD-src-6861248dfcd7d5c6641f437335516c106f83df33.zip
FreeBSD-src-6861248dfcd7d5c6641f437335516c106f83df33.tar.gz
None of the users of Buf_Discard used it to get rid of only a part of
the buffer. So replace Buf_Discard by Buf_Clear which just gets rid of the entire contents. Submitted by: Max Okumoto <okumoto@ucsd.edu>
Diffstat (limited to 'usr.bin/make/buf.c')
-rw-r--r--usr.bin/make/buf.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c
index b9a4a43..c4294bd 100644
--- a/usr.bin/make/buf.c
+++ b/usr.bin/make/buf.c
@@ -165,31 +165,6 @@ Buf_GetAll(Buffer *bp, size_t *numBytesPtr)
/*-
*-----------------------------------------------------------------------
- * Buf_Discard --
- * Throw away bytes in a buffer.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * The bytes are discarded.
- *
- *-----------------------------------------------------------------------
- */
-void
-Buf_Discard(Buffer *bp, size_t numBytes)
-{
-
- if ((size_t)(bp->inPtr - bp->outPtr) <= numBytes) {
- bp->inPtr = bp->outPtr = bp->buffer;
- bp->left = bp->size;
- *bp->inPtr = 0;
- } else
- bp->outPtr += numBytes;
-}
-
-/*-
- *-----------------------------------------------------------------------
* Buf_Size --
* Returns the number of bytes in the given buffer. Doesn't include
* the null-terminating byte.
@@ -286,3 +261,13 @@ Buf_ReplaceLastByte(Buffer *buf, Byte byte)
else
*(buf->inPtr - 1) = byte;
}
+
+void
+Buf_Clear(Buffer *bp)
+{
+ bp->inPtr = bp->buffer;
+ bp->outPtr = bp->buffer;
+ bp->left = bp->size;
+ bp->inPtr[0] = '\0';
+}
+
OpenPOWER on IntegriCloud