diff options
| author | Simon J. Gerraty <sjg@FreeBSD.org> | 2022-02-05 20:03:50 +0000 |
|---|---|---|
| committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2022-02-05 20:03:50 +0000 |
| commit | cdde9e894dee2074ef0dd12ddc171e5d3f1513e3 (patch) | |
| tree | ffa1b3cea06486f9780c271c39db0bc2e7b006e9 /buf.c | |
| parent | 2935fe8237c83c1dcb113dd5335733263e68e6fd (diff) | |
Diffstat (limited to 'buf.c')
| -rw-r--r-- | buf.c | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.53 2021/11/28 22:48:06 rillig Exp $ */ +/* $NetBSD: buf.c,v 1.55 2022/01/08 17:25:19 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -75,7 +75,7 @@ #include "make.h" /* "@(#)buf.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: buf.c,v 1.53 2021/11/28 22:48:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: buf.c,v 1.55 2022/01/08 17:25:19 rillig Exp $"); /* Make space in the buffer for adding at least 16 more bytes. */ void @@ -138,14 +138,6 @@ Buf_AddFlag(Buffer *buf, bool flag, const char *name) } } -/* Mark the buffer as empty, so it can be filled with data again. */ -void -Buf_Empty(Buffer *buf) -{ - buf->len = 0; - buf->data[0] = '\0'; -} - /* Initialize a buffer. */ void Buf_InitSize(Buffer *buf, size_t cap) @@ -214,8 +206,9 @@ Buf_DoneDataCompact(Buffer *buf) if (buf->cap - buf->len >= BUF_COMPACT_LIMIT) { /* We trust realloc to be smart */ char *data = bmake_realloc(buf->data, buf->len + 1); + buf->data = NULL; data[buf->len] = '\0'; /* XXX: unnecessary */ - Buf_DoneData(buf); + Buf_Done(buf); return data; } #endif |
