zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 6a8fb060067685a2ff27d05092f3fcf2ee17e83c (tree)
parent e5627f8e635c05a91edeb97b6d0e392d095ce39f
Author: Greg V <greg@unrelenting.technology>
Date:   Wed, 17 Oct 2018 18:00:36 +0300

Split at zero byte in SplitIterator

To avoid extra zeros in buffers

Diffstat:
Msrc/util.cpp | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util.cpp b/src/util.cpp @@ -47,7 +47,7 @@ bool ptr_eq(const void *a, const void *b) { // Ported from std/mem.zig. bool SplitIterator_isSplitByte(SplitIterator *self, uint8_t byte) { for (size_t i = 0; i < self->split_bytes.len; i += 1) { - if (byte == self->split_bytes.ptr[i]) { + if (byte == self->split_bytes.ptr[i] || byte == 0) { return true; } }