commit 8884f78e95b675a3172cdee1a8ea54726b6904a7
parent 328c8a7890eb61a7f267631b9f9c7fb2f7e8a94b
Author: Bor Grošelj Simić <bgs@turminal.net>
Date: Sat, 23 Apr 2022 00:45:31 +0200
bufio::buffered: merge two identical if branches
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/bufio/buffered.ha b/bufio/buffered.ha
@@ -67,16 +67,14 @@ export fn buffered(
...
};
if (len(rbuf) != 0 && len(wbuf) != 0) {
+ assert(rbuf: *[*]u8 != wbuf: *[*]u8,
+ "Cannot use bufio::buffered with same buffer for reads and writes");
s.stream = &buffered_vtable_rw;
} else if (len(rbuf) != 0) {
s.stream = &buffered_vtable_r;
} else if (len(wbuf) != 0) {
s.stream = &buffered_vtable_w;
} else abort("Must provide at least one buffer to bufio::buffered");
- if (len(rbuf) != 0 && len(wbuf) != 0) {
- assert(rbuf: *[*]u8 != wbuf: *[*]u8,
- "Cannot use bufio::buffered with same buffer for reads and writes");
- };
return s;
};