zig

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

commit af730c64bd760a2fee7418b5d4b8912e3aec4eed (tree)
parent d770dae1b8ad385d47ec716ab23eca8ca92c31d5
Author: LeRoyce Pearson <leroycepearson@geemili.xyz>
Date:   Tue, 14 Apr 2020 19:07:27 -0600

Put base64 alphabet into a named constant

Diffstat:
Mlib/std/fs.zig | 18+++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)

diff --git 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, -); - -/// 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, -); +pub const base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; + +/// 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.