diff options
author | 2022-02-21 16:27:44 -0800 | |
---|---|---|
committer | 2022-02-21 16:27:44 -0800 | |
commit | 931670b7cb0e0c85504c171732b98bc0ad568d46 (patch) | |
tree | 17e0d6358f9c6f6d9a94becb12c56805ad29b2c3 /src/query_string_map.zig | |
parent | 427de617028872a7055b41c61776ef5c965d567a (diff) | |
download | bun-931670b7cb0e0c85504c171732b98bc0ad568d46.tar.gz bun-931670b7cb0e0c85504c171732b98bc0ad568d46.tar.zst bun-931670b7cb0e0c85504c171732b98bc0ad568d46.zip |
Wrap some usages of `assert` in a conditional
See https://github.com/ziglang/zig/issues/10942
Diffstat (limited to 'src/query_string_map.zig')
-rw-r--r-- | src/query_string_map.zig | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/query_string_map.zig b/src/query_string_map.zig index 292e581b0..b9713214b 100644 --- a/src/query_string_map.zig +++ b/src/query_string_map.zig @@ -361,7 +361,7 @@ pub const URL = struct { '@' => { // we found a password, everything before this point in the slice is a password url.password = str[0..i]; - std.debug.assert(str[i..].len < 2 or std.mem.readIntNative(u16, str[i..][0..2]) != std.mem.readIntNative(u16, "//")); + if (Environment.allow_assert) std.debug.assert(str[i..].len < 2 or std.mem.readIntNative(u16, str[i..][0..2]) != std.mem.readIntNative(u16, "//")); return i + 1; }, // if we reach a slash, there's no password @@ -562,7 +562,8 @@ pub const QueryStringMap = struct { count += 1; } - std.debug.assert(count > 0); // We should not call initWithScanner when there are no path params + if (Environment.allow_assert) + std.debug.assert(count > 0); // We should not call initWithScanner when there are no path params while (scanner.query.next()) |result| { if (result.name_needs_decoding or result.value_needs_decoding) { @@ -677,8 +678,8 @@ pub const QueryStringMap = struct { if (nothing_needs_decoding) { scanner = Scanner.init(query_string); while (scanner.next()) |result| { - std.debug.assert(!result.name_needs_decoding); - std.debug.assert(!result.value_needs_decoding); + if (Environment.allow_assert) std.debug.assert(!result.name_needs_decoding); + if (Environment.allow_assert) std.debug.assert(!result.value_needs_decoding); var name = result.name; var value = result.value; |