From af730c64bd760a2fee7418b5d4b8912e3aec4eed Mon Sep 17 00:00:00 2001 From: LeRoyce Pearson Date: Tue, 14 Apr 2020 19:07:27 -0600 Subject: [PATCH] Put base64 alphabet into a named constant --- lib/std/fs.zig | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/std/fs.zig b/lib/std/fs.zig index c3e8d69b0d..99383277a7 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -49,17 +49,13 @@ pub const MAX_PATH_BYTES = switch (builtin.os.tag) { else => @compileError("Unsupported OS"), }; -/// Base64, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem. -pub const base64_encoder = base64.Base64Encoder.init( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", - base64.standard_pad_char, -); +pub const base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; -/// Base64, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem. -pub const base64_decoder = base64.Base64Decoder.init( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", - base64.standard_pad_char, -); +/// Base64 encoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem. +pub const base64_encoder = base64.Base64Encoder.init(base64_alphabet, base64.standard_pad_char); + +/// Base64 decoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem. +pub const base64_decoder = base64.Base64Decoder.init(base64_alphabet, base64.standard_pad_char); /// Whether or not async file system syscalls need a dedicated thread because the operating /// system does not support non-blocking I/O on the file system.