authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-04-30 18:02:08+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-30 18:16:04-07:00
log94e30a756edc4c2182168dabd97d481b8aec0ff2
tree50d4273d99ddd7a442d62b615cf9dc6128e71fef
parentec6ffaa1e47388a59035277dafbe3d9999a80fca

std: fix a bunch of typos

The majority of these are in comments, some in doc comments which might affect the generated documentation, and a few in parameter names - nothing that should be breaking, however.

50 files changed, 97 insertions(+), 97 deletions(-)

lib/std/Build/Cache/DepTokenizer.zig+1-1
...@@ -829,7 +829,7 @@ test "error illegal char at position - bad target escape" {...@@ -829,7 +829,7 @@ test "error illegal char at position - bad target escape" {
829 );829 );
830}830}
831831
832test "error illegal char at position - execting dollar_sign" {832test "error illegal char at position - expecting dollar_sign" {
833 try depTokenizer("$\t",833 try depTokenizer("$\t",
834 \\ERROR: illegal char \x09 at position 1: expecting '$'834 \\ERROR: illegal char \x09 at position 1: expecting '$'
835 );835 );
lib/std/Build/CheckObjectStep.zig+1-1
...@@ -68,7 +68,7 @@ const SearchPhrase = struct {...@@ -68,7 +68,7 @@ const SearchPhrase = struct {
68 }68 }
69};69};
7070
71/// There two types of actions currently suported:71/// There two types of actions currently supported:
72/// * `.match` - is the main building block of standard matchers with optional eat-all token `{*}`72/// * `.match` - is the main building block of standard matchers with optional eat-all token `{*}`
73/// and extractors by name such as `{n_value}`. Please note this action is very simplistic in nature73/// and extractors by name such as `{n_value}`. Please note this action is very simplistic in nature
74/// i.e., it won't really handle edge cases/nontrivial examples. But given that we do want to use74/// i.e., it won't really handle edge cases/nontrivial examples. But given that we do want to use
lib/std/Build/RunStep.zig+1-1
...@@ -90,7 +90,7 @@ pub const StdIo = union(enum) {...@@ -90,7 +90,7 @@ pub const StdIo = union(enum) {
90 /// certain conditions, and the step will succeed or fail based on these90 /// certain conditions, and the step will succeed or fail based on these
91 /// conditions.91 /// conditions.
92 /// Note that an explicit check for exit code 0 needs to be added to this92 /// Note that an explicit check for exit code 0 needs to be added to this
93 /// list if such a check is desireable.93 /// list if such a check is desirable.
94 check: std.ArrayList(Check),94 check: std.ArrayList(Check),
95 /// This RunStep is running a zig unit test binary and will communicate95 /// This RunStep is running a zig unit test binary and will communicate
96 /// extra metadata over the IPC protocol.96 /// extra metadata over the IPC protocol.
lib/std/Build/Step.zig+1-1
...@@ -37,7 +37,7 @@ result_duration_ns: ?u64,...@@ -37,7 +37,7 @@ result_duration_ns: ?u64,
37result_peak_rss: usize,37result_peak_rss: usize,
38test_results: TestResults,38test_results: TestResults,
3939
40/// The return addresss associated with creation of this step that can be useful40/// The return address associated with creation of this step that can be useful
41/// to print along with debugging messages.41/// to print along with debugging messages.
42debug_stack_trace: [n_debug_stack_frames]usize,42debug_stack_trace: [n_debug_stack_frames]usize,
4343
lib/std/Thread.zig+2-2
...@@ -469,8 +469,8 @@ const UnsupportedImpl = struct {...@@ -469,8 +469,8 @@ const UnsupportedImpl = struct {
469 return unsupported(self);469 return unsupported(self);
470 }470 }
471471
472 fn unsupported(unusued: anytype) noreturn {472 fn unsupported(unused: anytype) noreturn {
473 _ = unusued;473 _ = unused;
474 @compileError("Unsupported operating system " ++ @tagName(target.os.tag));474 @compileError("Unsupported operating system " ++ @tagName(target.os.tag));
475 }475 }
476};476};
lib/std/Thread/Condition.zig+1-1
...@@ -261,7 +261,7 @@ const FutexImpl = struct {...@@ -261,7 +261,7 @@ const FutexImpl = struct {
261 const signals = (state & signal_mask) / one_signal;261 const signals = (state & signal_mask) / one_signal;
262262
263 // Reserves which waiters to wake up by incrementing the signals count.263 // Reserves which waiters to wake up by incrementing the signals count.
264 // Therefor, the signals count is always less than or equal to the waiters count.264 // Therefore, the signals count is always less than or equal to the waiters count.
265 // We don't need to Futex.wake if there's nothing to wake up or if other wake() threads have reserved to wake up the current waiters.265 // We don't need to Futex.wake if there's nothing to wake up or if other wake() threads have reserved to wake up the current waiters.
266 const wakeable = waiters - signals;266 const wakeable = waiters - signals;
267 if (wakeable == 0) {267 if (wakeable == 0) {
lib/std/Thread/Futex.zig+1-1
...@@ -772,7 +772,7 @@ const PosixImpl = struct {...@@ -772,7 +772,7 @@ const PosixImpl = struct {
772772
773 waiter.event.wait(timeout) catch {773 waiter.event.wait(timeout) catch {
774 // If we fail to cancel after a timeout, it means a wake() thread dequeued us and will wake us up.774 // If we fail to cancel after a timeout, it means a wake() thread dequeued us and will wake us up.
775 // We must wait until the event is set as that's a signal that the wake() thread wont access the waiter memory anymore.775 // We must wait until the event is set as that's a signal that the wake() thread won't access the waiter memory anymore.
776 // If we return early without waiting, the waiter on the stack would be invalidated and the wake() thread risks a UAF.776 // If we return early without waiting, the waiter on the stack would be invalidated and the wake() thread risks a UAF.
777 defer if (!cancelled) waiter.event.wait(null) catch unreachable;777 defer if (!cancelled) waiter.event.wait(null) catch unreachable;
778778
lib/std/atomic/Atomic.zig+1-1
...@@ -31,7 +31,7 @@ pub fn Atomic(comptime T: type) type {...@@ -31,7 +31,7 @@ pub fn Atomic(comptime T: type) type {
31 /// // Release ensures code before unref() happens-before the count is decremented as dropFn could be called by then.31 /// // Release ensures code before unref() happens-before the count is decremented as dropFn could be called by then.
32 /// if (self.count.fetchSub(1, .Release)) {32 /// if (self.count.fetchSub(1, .Release)) {
33 /// // Acquire ensures count decrement and code before previous unrefs()s happens-before we call dropFn below.33 /// // Acquire ensures count decrement and code before previous unrefs()s happens-before we call dropFn below.
34 /// // NOTE: another alterative is to use .AcqRel on the fetchSub count decrement but it's extra barrier in possibly hot path.34 /// // NOTE: another alternative is to use .AcqRel on the fetchSub count decrement but it's extra barrier in possibly hot path.
35 /// self.count.fence(.Acquire);35 /// self.count.fence(.Acquire);
36 /// (self.dropFn)(self);36 /// (self.dropFn)(self);
37 /// }37 /// }
lib/std/builtin.zig+1-1
...@@ -749,7 +749,7 @@ pub const PrefetchOptions = struct {...@@ -749,7 +749,7 @@ pub const PrefetchOptions = struct {
749 /// 3 means high temporal locality. That is, the data should be kept in749 /// 3 means high temporal locality. That is, the data should be kept in
750 /// the cache as it is likely to be accessed again soon.750 /// the cache as it is likely to be accessed again soon.
751 locality: u2 = 3,751 locality: u2 = 3,
752 /// The cache that the prefetch should be preformed on.752 /// The cache that the prefetch should be performed on.
753 cache: Cache = .data,753 cache: Cache = .data,
754754
755 pub const Rw = enum(u1) {755 pub const Rw = enum(u1) {
lib/std/c/darwin.zig+4-4
...@@ -178,13 +178,13 @@ pub extern "c" fn __getdirentries64(fd: c_int, buf_ptr: [*]u8, buf_len: usize, b...@@ -178,13 +178,13 @@ pub extern "c" fn __getdirentries64(fd: c_int, buf_ptr: [*]u8, buf_len: usize, b
178178
179const private = struct {179const private = struct {
180 extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int;180 extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int;
181 /// On x86_64 Darwin, fstat has to be manully linked with $INODE64 suffix to181 /// On x86_64 Darwin, fstat has to be manually linked with $INODE64 suffix to
182 /// force 64bit version.182 /// force 64bit version.
183 /// Note that this is fixed on aarch64 and no longer necessary.183 /// Note that this is fixed on aarch64 and no longer necessary.
184 extern "c" fn @"fstat$INODE64"(fd: fd_t, buf: *Stat) c_int;184 extern "c" fn @"fstat$INODE64"(fd: fd_t, buf: *Stat) c_int;
185185
186 extern "c" fn fstatat(dirfd: fd_t, path: [*:0]const u8, stat_buf: *Stat, flags: u32) c_int;186 extern "c" fn fstatat(dirfd: fd_t, path: [*:0]const u8, stat_buf: *Stat, flags: u32) c_int;
187 /// On x86_64 Darwin, fstatat has to be manully linked with $INODE64 suffix to187 /// On x86_64 Darwin, fstatat has to be manually linked with $INODE64 suffix to
188 /// force 64bit version.188 /// force 64bit version.
189 /// Note that this is fixed on aarch64 and no longer necessary.189 /// Note that this is fixed on aarch64 and no longer necessary.
190 extern "c" fn @"fstatat$INODE64"(dirfd: fd_t, path_name: [*:0]const u8, buf: *Stat, flags: u32) c_int;190 extern "c" fn @"fstatat$INODE64"(dirfd: fd_t, path_name: [*:0]const u8, buf: *Stat, flags: u32) c_int;
...@@ -2643,7 +2643,7 @@ pub const F = struct {...@@ -2643,7 +2643,7 @@ pub const F = struct {
2643 pub const ADDSIGS = 59;2643 pub const ADDSIGS = 59;
2644 /// add signature from same file (used by dyld for shared libs)2644 /// add signature from same file (used by dyld for shared libs)
2645 pub const ADDFILESIGS = 61;2645 pub const ADDFILESIGS = 61;
2646 /// used in conjunction with F.NOCACHE to indicate that DIRECT, synchonous writes2646 /// used in conjunction with F.NOCACHE to indicate that DIRECT, synchronous writes
2647 /// should not be used (i.e. its ok to temporaily create cached pages)2647 /// should not be used (i.e. its ok to temporaily create cached pages)
2648 pub const NODIRECT = 62;2648 pub const NODIRECT = 62;
2649 ///Get the protection class of a file from the EA, returns int2649 ///Get the protection class of a file from the EA, returns int
...@@ -3866,4 +3866,4 @@ pub const MIN = struct {...@@ -3866,4 +3866,4 @@ pub const MIN = struct {
3866 pub const ANONYMOUS = 0x80;3866 pub const ANONYMOUS = 0x80;
3867};3867};
38683868
3869pub extern "c" fn mincore(addr: *align(std.mem.page_size) const anyopaque, lengh: usize, vec: [*]u8) c_int;3869pub extern "c" fn mincore(addr: *align(std.mem.page_size) const anyopaque, length: usize, vec: [*]u8) c_int;
lib/std/c/solaris.zig+1-1
...@@ -1822,7 +1822,7 @@ pub const file_obj = extern struct {...@@ -1822,7 +1822,7 @@ pub const file_obj = extern struct {
1822 name: [*:0]u8,1822 name: [*:0]u8,
1823};1823};
18241824
1825// struct ifreq is marked obsolete, with struct lifreq prefered for interface requests.1825// struct ifreq is marked obsolete, with struct lifreq preferred for interface requests.
1826// Here we alias lifreq to ifreq to avoid chainging existing code in os and x.os.IPv6.1826// Here we alias lifreq to ifreq to avoid chainging existing code in os and x.os.IPv6.
1827pub const SIOCGLIFINDEX = IOWR('i', 133, lifreq);1827pub const SIOCGLIFINDEX = IOWR('i', 133, lifreq);
1828pub const SIOCGIFINDEX = SIOCGLIFINDEX;1828pub const SIOCGIFINDEX = SIOCGLIFINDEX;
lib/std/child_process.zig+1-1
...@@ -1174,7 +1174,7 @@ fn windowsCreateProcess(app_name: [*:0]u16, cmd_line: [*:0]u16, envp_ptr: ?[*]u1...@@ -1174,7 +1174,7 @@ fn windowsCreateProcess(app_name: [*:0]u16, cmd_line: [*:0]u16, envp_ptr: ?[*]u1
1174 );1174 );
1175}1175}
11761176
1177/// Case-insenstive UTF-16 lookup1177/// Case-insensitive UTF-16 lookup
1178fn windowsCreateProcessSupportsExtension(ext: []const u16) bool {1178fn windowsCreateProcessSupportsExtension(ext: []const u16) bool {
1179 if (ext.len != 4) return false;1179 if (ext.len != 4) return false;
1180 const State = enum {1180 const State = enum {
lib/std/compress/deflate/huffman_code.zig+1-1
...@@ -421,7 +421,7 @@ test "generate a Huffman code from an array of frequencies" {...@@ -421,7 +421,7 @@ test "generate a Huffman code from an array of frequencies" {
421 try testing.expectEqual(@as(u16, 0x3f), enc.codes[16].code);421 try testing.expectEqual(@as(u16, 0x3f), enc.codes[16].code);
422}422}
423423
424test "generate a Huffman code for the fixed litteral table specific to Deflate" {424test "generate a Huffman code for the fixed literal table specific to Deflate" {
425 var enc = try generateFixedLiteralEncoding(testing.allocator);425 var enc = try generateFixedLiteralEncoding(testing.allocator);
426 defer enc.deinit();426 defer enc.deinit();
427}427}
lib/std/crypto/25519/edwards25519.zig+2-2
...@@ -137,7 +137,7 @@ pub const Edwards25519 = struct {...@@ -137,7 +137,7 @@ pub const Edwards25519 = struct {
137 };137 };
138 }138 }
139139
140 /// Substract two Edwards25519 points.140 /// Subtract two Edwards25519 points.
141 pub fn sub(p: Edwards25519, q: Edwards25519) Edwards25519 {141 pub fn sub(p: Edwards25519, q: Edwards25519) Edwards25519 {
142 return p.add(q.neg());142 return p.add(q.neg());
143 }143 }
...@@ -529,7 +529,7 @@ test "edwards25519 packing/unpacking" {...@@ -529,7 +529,7 @@ test "edwards25519 packing/unpacking" {
529 }529 }
530}530}
531531
532test "edwards25519 point addition/substraction" {532test "edwards25519 point addition/subtraction" {
533 var s1: [32]u8 = undefined;533 var s1: [32]u8 = undefined;
534 var s2: [32]u8 = undefined;534 var s2: [32]u8 = undefined;
535 crypto.random.bytes(&s1);535 crypto.random.bytes(&s1);
lib/std/crypto/25519/field.zig+1-1
...@@ -179,7 +179,7 @@ pub const Fe = struct {...@@ -179,7 +179,7 @@ pub const Fe = struct {
179 return fe;179 return fe;
180 }180 }
181181
182 /// Substract a field element182 /// Subtract a field element
183 pub inline fn sub(a: Fe, b: Fe) Fe {183 pub inline fn sub(a: Fe, b: Fe) Fe {
184 var fe = b;184 var fe = b;
185 comptime var i = 0;185 comptime var i = 0;
lib/std/crypto/Certificate.zig+2-2
...@@ -1134,9 +1134,9 @@ pub const rsa = struct {...@@ -1134,9 +1134,9 @@ pub const rsa = struct {
1134 return res;1134 return res;
1135 }1135 }
11361136
1137 fn setBytes(r: *BigInt, bytes: []const u8, allcator: std.mem.Allocator) !void {1137 fn setBytes(r: *BigInt, bytes: []const u8, allocator: std.mem.Allocator) !void {
1138 try r.set(0);1138 try r.set(0);
1139 var tmp = try BigInt.init(allcator);1139 var tmp = try BigInt.init(allocator);
1140 defer tmp.deinit();1140 defer tmp.deinit();
1141 for (bytes) |b| {1141 for (bytes) |b| {
1142 try r.shiftLeft(r, 8);1142 try r.shiftLeft(r, 8);
lib/std/crypto/errors.zig+1-1
...@@ -10,7 +10,7 @@ pub const IdentityElementError = error{IdentityElement};...@@ -10,7 +10,7 @@ pub const IdentityElementError = error{IdentityElement};
10/// Encoded input cannot be decoded10/// Encoded input cannot be decoded
11pub const EncodingError = error{InvalidEncoding};11pub const EncodingError = error{InvalidEncoding};
1212
13/// The signature does't verify for the given message and public key13/// The signature doesn't verify for the given message and public key
14pub const SignatureVerificationError = error{SignatureVerificationFailed};14pub const SignatureVerificationError = error{SignatureVerificationFailed};
1515
16/// Both a public and secret key have been provided, but they are incompatible16/// Both a public and secret key have been provided, but they are incompatible
lib/std/crypto/kyber_d00.zig+2-2
...@@ -80,7 +80,7 @@...@@ -80,7 +80,7 @@
80//! m = Compress(Decompress(c_2, d_v) - s^T Decompress(c_1, d_u), 1).80//! m = Compress(Decompress(c_2, d_v) - s^T Decompress(c_1, d_u), 1).
81//!81//!
82//! It it not straight-forward to see that this formula is correct. In82//! It it not straight-forward to see that this formula is correct. In
83//! fact, there is negligable but non-zero probability that a ciphertext83//! fact, there is negligible but non-zero probability that a ciphertext
84//! does not decrypt correctly given by the DFP column in Table 4. This84//! does not decrypt correctly given by the DFP column in Table 4. This
85//! failure probability can be computed by a careful automated analysis85//! failure probability can be computed by a careful automated analysis
86//! of the probabilities involved, see kyber_failure.py of [SecEst].86//! of the probabilities involved, see kyber_failure.py of [SecEst].
...@@ -640,7 +640,7 @@ fn montReduce(x: i32) i16 {...@@ -640,7 +640,7 @@ fn montReduce(x: i32) i16 {
640 // we have int32(int64(a)*int64(b)) = int32(a*b) and so the result is ok.640 // we have int32(int64(a)*int64(b)) = int32(a*b) and so the result is ok.
641 const m = @truncate(i16, @truncate(i32, x *% qInv));641 const m = @truncate(i16, @truncate(i32, x *% qInv));
642642
643 // Note that x - m q is divisable by R; indeed modulo R we have643 // Note that x - m q is divisible by R; indeed modulo R we have
644 //644 //
645 // x - m q ≡ x - x q' q ≡ x - x q⁻¹ q ≡ x - x = 0.645 // x - m q ≡ x - x q' q ≡ x - x q⁻¹ q ≡ x - x = 0.
646 //646 //
lib/std/event/lock.zig+2-2
...@@ -36,7 +36,7 @@ pub const Lock = struct {...@@ -36,7 +36,7 @@ pub const Lock = struct {
3636
37 // self.head transitions from multiple stages depending on the value:37 // self.head transitions from multiple stages depending on the value:
38 // UNLOCKED -> LOCKED:38 // UNLOCKED -> LOCKED:
39 // acquire Lock ownership when theres no waiters39 // acquire Lock ownership when there are no waiters
40 // LOCKED -> <Waiter head ptr>:40 // LOCKED -> <Waiter head ptr>:
41 // Lock is already owned, enqueue first Waiter41 // Lock is already owned, enqueue first Waiter
42 // <head ptr> -> <head ptr>:42 // <head ptr> -> <head ptr>:
...@@ -87,7 +87,7 @@ pub const Lock = struct {...@@ -87,7 +87,7 @@ pub const Lock = struct {
8787
88 // self.head goes through the reverse transition from acquire():88 // self.head goes through the reverse transition from acquire():
89 // <head ptr> -> <new head ptr>:89 // <head ptr> -> <new head ptr>:
90 // pop a waiter from the queue to give Lock ownership when theres still others pending90 // pop a waiter from the queue to give Lock ownership when there are still others pending
91 // <head ptr> -> LOCKED:91 // <head ptr> -> LOCKED:
92 // pop the laster waiter from the queue, while also giving it lock ownership when awaken92 // pop the laster waiter from the queue, while also giving it lock ownership when awaken
93 // LOCKED -> UNLOCKED:93 // LOCKED -> UNLOCKED:
lib/std/event/loop.zig+3-3
...@@ -903,7 +903,7 @@ pub const Loop = struct {...@@ -903,7 +903,7 @@ pub const Loop = struct {
903 }903 }
904 }904 }
905905
906 // TODO: use a tickless heirarchical timer wheel:906 // TODO: use a tickless hierarchical timer wheel:
907 // https://github.com/wahern/timeout/907 // https://github.com/wahern/timeout/
908 const Waiters = struct {908 const Waiters = struct {
909 entries: std.atomic.Queue(anyframe),909 entries: std.atomic.Queue(anyframe),
...@@ -947,7 +947,7 @@ pub const Loop = struct {...@@ -947,7 +947,7 @@ pub const Loop = struct {
947 // starting from the head947 // starting from the head
948 var head = self.entries.head orelse return null;948 var head = self.entries.head orelse return null;
949949
950 // traverse the list of waiting entires to950 // traverse the list of waiting entries to
951 // find the Node with the smallest `expires` field951 // find the Node with the smallest `expires` field
952 var min = head;952 var min = head;
953 while (head.next) |node| {953 while (head.next) |node| {
...@@ -1756,7 +1756,7 @@ test "std.event.Loop - runDetached" {...@@ -1756,7 +1756,7 @@ test "std.event.Loop - runDetached" {
1756 try loop.runDetached(std.testing.allocator, testRunDetached, .{});1756 try loop.runDetached(std.testing.allocator, testRunDetached, .{});
17571757
1758 // Now we can start the event loop. The function will return only1758 // Now we can start the event loop. The function will return only
1759 // after all tasks have been completed, allowing us to synchonize1759 // after all tasks have been completed, allowing us to synchronize
1760 // with the previous runDetached.1760 // with the previous runDetached.
1761 loop.run();1761 loop.run();
17621762
lib/std/fmt/parse_float/convert_fast.zig+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1//! Representation of a float as the signficant digits and exponent.1//! Representation of a float as the significant digits and exponent.
2//! The fast path algorithm using machine-sized integers and floats.2//! The fast path algorithm using machine-sized integers and floats.
3//!3//!
4//! This only works if both the mantissa and the exponent can be exactly4//! This only works if both the mantissa and the exponent can be exactly
lib/std/fs/file.zig+2-2
...@@ -92,7 +92,7 @@ pub const File = struct {...@@ -92,7 +92,7 @@ pub const File = struct {
92 /// processes from acquiring a exclusive lock, but does not prevent92 /// processes from acquiring a exclusive lock, but does not prevent
93 /// other process from getting their own shared locks.93 /// other process from getting their own shared locks.
94 ///94 ///
95 /// The lock is advisory, except on Linux in very specific cirsumstances[1].95 /// The lock is advisory, except on Linux in very specific circumstances[1].
96 /// This means that a process that does not respect the locking API can still get access96 /// This means that a process that does not respect the locking API can still get access
97 /// to the file, despite the lock.97 /// to the file, despite the lock.
98 ///98 ///
...@@ -156,7 +156,7 @@ pub const File = struct {...@@ -156,7 +156,7 @@ pub const File = struct {
156 /// processes from acquiring a exclusive lock, but does not prevent156 /// processes from acquiring a exclusive lock, but does not prevent
157 /// other process from getting their own shared locks.157 /// other process from getting their own shared locks.
158 ///158 ///
159 /// The lock is advisory, except on Linux in very specific cirsumstances[1].159 /// The lock is advisory, except on Linux in very specific circumstances[1].
160 /// This means that a process that does not respect the locking API can still get access160 /// This means that a process that does not respect the locking API can still get access
161 /// to the file, despite the lock.161 /// to the file, despite the lock.
162 ///162 ///
lib/std/fs/path.zig+2-2
...@@ -105,13 +105,13 @@ fn joinSepMaybeZ(allocator: Allocator, separator: u8, comptime sepPredicate: fn...@@ -105,13 +105,13 @@ fn joinSepMaybeZ(allocator: Allocator, separator: u8, comptime sepPredicate: fn
105 return buf;105 return buf;
106}106}
107107
108/// Naively combines a series of paths with the native path seperator.108/// Naively combines a series of paths with the native path separator.
109/// Allocates memory for the result, which must be freed by the caller.109/// Allocates memory for the result, which must be freed by the caller.
110pub fn join(allocator: Allocator, paths: []const []const u8) ![]u8 {110pub fn join(allocator: Allocator, paths: []const []const u8) ![]u8 {
111 return joinSepMaybeZ(allocator, sep, isSep, paths, false);111 return joinSepMaybeZ(allocator, sep, isSep, paths, false);
112}112}
113113
114/// Naively combines a series of paths with the native path seperator and null terminator.114/// Naively combines a series of paths with the native path separator and null terminator.
115/// Allocates memory for the result, which must be freed by the caller.115/// Allocates memory for the result, which must be freed by the caller.
116pub fn joinZ(allocator: Allocator, paths: []const []const u8) ![:0]u8 {116pub fn joinZ(allocator: Allocator, paths: []const []const u8) ![:0]u8 {
117 const out = try joinSepMaybeZ(allocator, sep, isSep, paths, true);117 const out = try joinSepMaybeZ(allocator, sep, isSep, paths, true);
lib/std/hash_map.zig+1-1
...@@ -690,7 +690,7 @@ pub fn HashMap(...@@ -690,7 +690,7 @@ pub fn HashMap(
690/// It achieves good performance with quite high load factors (by default,690/// It achieves good performance with quite high load factors (by default,
691/// grow is triggered at 80% full) and only one byte of overhead per element.691/// grow is triggered at 80% full) and only one byte of overhead per element.
692/// The struct itself is only 16 bytes for a small footprint. This comes at692/// The struct itself is only 16 bytes for a small footprint. This comes at
693/// the price of handling size with u32, which should be reasonnable enough693/// the price of handling size with u32, which should be reasonable enough
694/// for almost all uses.694/// for almost all uses.
695/// Deletions are achieved with tombstones.695/// Deletions are achieved with tombstones.
696pub fn HashMapUnmanaged(696pub fn HashMapUnmanaged(
lib/std/heap.zig+1-1
...@@ -79,7 +79,7 @@ const CAllocator = struct {...@@ -79,7 +79,7 @@ const CAllocator = struct {
79 }79 }
8080
81 // Thin wrapper around regular malloc, overallocate to account for81 // Thin wrapper around regular malloc, overallocate to account for
82 // alignment padding and store the orignal malloc()'ed pointer before82 // alignment padding and store the original malloc()'ed pointer before
83 // the aligned address.83 // the aligned address.
84 var unaligned_ptr = @ptrCast([*]u8, c.malloc(len + alignment - 1 + @sizeOf(usize)) orelse return null);84 var unaligned_ptr = @ptrCast([*]u8, c.malloc(len + alignment - 1 + @sizeOf(usize)) orelse return null);
85 const unaligned_addr = @ptrToInt(unaligned_ptr);85 const unaligned_addr = @ptrToInt(unaligned_ptr);
lib/std/heap/arena_allocator.zig+1-1
...@@ -136,7 +136,7 @@ pub const ArenaAllocator = struct {...@@ -136,7 +136,7 @@ pub const ArenaAllocator = struct {
136 it = next_it;136 it = next_it;
137 } else null;137 } else null;
138 std.debug.assert(maybe_first_node == null or maybe_first_node.?.next == null);138 std.debug.assert(maybe_first_node == null or maybe_first_node.?.next == null);
139 // reset the state before we try resizing the buffers, so we definitly have reset the arena to 0.139 // reset the state before we try resizing the buffers, so we definitely have reset the arena to 0.
140 self.state.end_index = 0;140 self.state.end_index = 0;
141 if (maybe_first_node) |first_node| {141 if (maybe_first_node) |first_node| {
142 // perfect, no need to invoke the child_allocator142 // perfect, no need to invoke the child_allocator
lib/std/heap/general_purpose_allocator.zig+2-2
...@@ -130,7 +130,7 @@ pub const Config = struct {...@@ -130,7 +130,7 @@ pub const Config = struct {
130 thread_safe: bool = !builtin.single_threaded,130 thread_safe: bool = !builtin.single_threaded,
131131
132 /// What type of mutex you'd like to use, for thread safety.132 /// What type of mutex you'd like to use, for thread safety.
133 /// when specfied, the mutex type must have the same shape as `std.Thread.Mutex` and133 /// when specified, the mutex type must have the same shape as `std.Thread.Mutex` and
134 /// `DummyMutex`, and have no required fields. Specifying this field causes134 /// `DummyMutex`, and have no required fields. Specifying this field causes
135 /// the `thread_safe` field to be ignored.135 /// the `thread_safe` field to be ignored.
136 ///136 ///
...@@ -1241,7 +1241,7 @@ test "realloc large object to small object" {...@@ -1241,7 +1241,7 @@ test "realloc large object to small object" {
1241 try std.testing.expect(slice[16] == 0x34);1241 try std.testing.expect(slice[16] == 0x34);
1242}1242}
12431243
1244test "overrideable mutexes" {1244test "overridable mutexes" {
1245 var gpa = GeneralPurposeAllocator(.{ .MutexType = std.Thread.Mutex }){1245 var gpa = GeneralPurposeAllocator(.{ .MutexType = std.Thread.Mutex }){
1246 .backing_allocator = std.testing.allocator,1246 .backing_allocator = std.testing.allocator,
1247 .mutex = std.Thread.Mutex{},1247 .mutex = std.Thread.Mutex{},
lib/std/heap/memory_pool.zig+1-1
...@@ -150,7 +150,7 @@ test "memory pool: basic" {...@@ -150,7 +150,7 @@ test "memory pool: basic" {
150 pool.destroy(p2);150 pool.destroy(p2);
151 const p4 = try pool.create();151 const p4 = try pool.create();
152152
153 // Assert memory resuse153 // Assert memory reuse
154 try std.testing.expect(p2 == p4);154 try std.testing.expect(p2 == p4);
155}155}
156156
lib/std/http.zig+1-1
...@@ -12,7 +12,7 @@ pub const Version = enum {...@@ -12,7 +12,7 @@ pub const Version = enum {
12};12};
1313
14/// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods14/// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
15/// https://datatracker.ietf.org/doc/html/rfc7231#section-4 Initial definiton15/// https://datatracker.ietf.org/doc/html/rfc7231#section-4 Initial definition
16/// https://datatracker.ietf.org/doc/html/rfc5789#section-2 PATCH16/// https://datatracker.ietf.org/doc/html/rfc5789#section-2 PATCH
17pub const Method = enum {17pub const Method = enum {
18 GET,18 GET,
lib/std/json.zig+1-1
...@@ -1603,7 +1603,7 @@ fn parseInternal(...@@ -1603,7 +1603,7 @@ fn parseInternal(
1603 if (fields_seen[i]) {1603 if (fields_seen[i]) {
1604 switch (options.duplicate_field_behavior) {1604 switch (options.duplicate_field_behavior) {
1605 .UseFirst => {1605 .UseFirst => {
1606 // unconditonally ignore value. for comptime fields, this skips check against default_value1606 // unconditionally ignore value. for comptime fields, this skips check against default_value
1607 parseFree(field.type, try parse(field.type, tokens, child_options), child_options);1607 parseFree(field.type, try parse(field.type, tokens, child_options), child_options);
1608 found = true;1608 found = true;
1609 break;1609 break;
lib/std/linked_list.zig+1-1
...@@ -406,7 +406,7 @@ test "TailQueue concatenation" {...@@ -406,7 +406,7 @@ test "TailQueue concatenation" {
406 }406 }
407 }407 }
408408
409 // Swap them back, this verifies that concating to an empty list works.409 // Swap them back, this verifies that concatenating to an empty list works.
410 list2.concatByMoving(&list1);410 list2.concatByMoving(&list1);
411411
412 // Traverse forwards.412 // Traverse forwards.
lib/std/macho.zig+6-6
...@@ -356,7 +356,7 @@ pub const dysymtab_command = extern struct {...@@ -356,7 +356,7 @@ pub const dysymtab_command = extern struct {
356356
357 // All the local relocation entries are grouped together (they are not357 // All the local relocation entries are grouped together (they are not
358 // grouped by their module since they are only used if the object is moved358 // grouped by their module since they are only used if the object is moved
359 // from it staticly link edited address).359 // from its statically link edited address).
360360
361 /// offset to local relocation entries361 /// offset to local relocation entries
362 locreloff: u32 = 0,362 locreloff: u32 = 0,
...@@ -418,7 +418,7 @@ pub const dyld_info_command = extern struct {...@@ -418,7 +418,7 @@ pub const dyld_info_command = extern struct {
418 // <seg-index, seg-offset, type, symbol-library-ordinal, symbol-name, addend>418 // <seg-index, seg-offset, type, symbol-library-ordinal, symbol-name, addend>
419 // The opcodes are a compressed way to encode the table by only419 // The opcodes are a compressed way to encode the table by only
420 // encoding when a column changes. In addition simple patterns420 // encoding when a column changes. In addition simple patterns
421 // like for runs of pointers initialzed to the same value can be421 // like for runs of pointers initialized to the same value can be
422 // encoded in a few bytes.422 // encoded in a few bytes.
423423
424 /// file offset to binding info424 /// file offset to binding info
...@@ -1141,7 +1141,7 @@ pub const MH_NOUNDEFS = 0x1;...@@ -1141,7 +1141,7 @@ pub const MH_NOUNDEFS = 0x1;
1141/// the object file is the output of an incremental link against a base file and can't be link edited again1141/// the object file is the output of an incremental link against a base file and can't be link edited again
1142pub const MH_INCRLINK = 0x2;1142pub const MH_INCRLINK = 0x2;
11431143
1144/// the object file is input for the dynamic linker and can't be staticly link edited again1144/// the object file is input for the dynamic linker and can't be statically link edited again
1145pub const MH_DYLDLINK = 0x4;1145pub const MH_DYLDLINK = 0x4;
11461146
1147/// the object file's undefined references are bound by the dynamic linker when loaded.1147/// the object file's undefined references are bound by the dynamic linker when loaded.
...@@ -1162,7 +1162,7 @@ pub const MH_TWOLEVEL = 0x80;...@@ -1162,7 +1162,7 @@ pub const MH_TWOLEVEL = 0x80;
1162/// the executable is forcing all images to use flat name space bindings1162/// the executable is forcing all images to use flat name space bindings
1163pub const MH_FORCE_FLAT = 0x100;1163pub const MH_FORCE_FLAT = 0x100;
11641164
1165/// this umbrella guarantees no multiple defintions of symbols in its sub-images so the two-level namespace hints can always be used.1165/// this umbrella guarantees no multiple definitions of symbols in its sub-images so the two-level namespace hints can always be used.
1166pub const MH_NOMULTIDEFS = 0x200;1166pub const MH_NOMULTIDEFS = 0x200;
11671167
1168/// do not have dyld notify the prebinding agent about this executable1168/// do not have dyld notify the prebinding agent about this executable
...@@ -1658,7 +1658,7 @@ pub const EXPORT_SYMBOL_FLAGS_REEXPORT: u8 = 0x08;...@@ -1658,7 +1658,7 @@ pub const EXPORT_SYMBOL_FLAGS_REEXPORT: u8 = 0x08;
1658pub const EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER: u8 = 0x10;1658pub const EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER: u8 = 0x10;
16591659
1660// An indirect symbol table entry is simply a 32bit index into the symbol table1660// An indirect symbol table entry is simply a 32bit index into the symbol table
1661// to the symbol that the pointer or stub is refering to. Unless it is for a1661// to the symbol that the pointer or stub is referring to. Unless it is for a
1662// non-lazy symbol pointer section for a defined symbol which strip(1) as1662// non-lazy symbol pointer section for a defined symbol which strip(1) as
1663// removed. In which case it has the value INDIRECT_SYMBOL_LOCAL. If the1663// removed. In which case it has the value INDIRECT_SYMBOL_LOCAL. If the
1664// symbol was also absolute INDIRECT_SYMBOL_ABS is or'ed with that.1664// symbol was also absolute INDIRECT_SYMBOL_ABS is or'ed with that.
...@@ -1741,7 +1741,7 @@ pub const CS_LINKER_SIGNED: u32 = 0x20000;...@@ -1741,7 +1741,7 @@ pub const CS_LINKER_SIGNED: u32 = 0x20000;
17411741
1742pub const CS_EXECSEG_MAIN_BINARY: u32 = 0x1;1742pub const CS_EXECSEG_MAIN_BINARY: u32 = 0x1;
17431743
1744/// This CodeDirectory is tailored specfically at version 0x20400.1744/// This CodeDirectory is tailored specifically at version 0x20400.
1745pub const CodeDirectory = extern struct {1745pub const CodeDirectory = extern struct {
1746 /// Magic number (CSMAGIC_CODEDIRECTORY)1746 /// Magic number (CSMAGIC_CODEDIRECTORY)
1747 magic: u32,1747 magic: u32,
lib/std/math/big/int.zig+10-10
...@@ -408,7 +408,7 @@ pub const Mutable = struct {...@@ -408,7 +408,7 @@ pub const Mutable = struct {
408 }408 }
409409
410 /// Base implementation for addition. Adds `max(a.limbs.len, b.limbs.len)` elements from a and b,410 /// Base implementation for addition. Adds `max(a.limbs.len, b.limbs.len)` elements from a and b,
411 /// and returns whether any overflow occured.411 /// and returns whether any overflow occurred.
412 /// r, a and b may be aliases.412 /// r, a and b may be aliases.
413 ///413 ///
414 /// Asserts r has enough elements to hold the result. The upper bound is `max(a.limbs.len, b.limbs.len)`.414 /// Asserts r has enough elements to hold the result. The upper bound is `max(a.limbs.len, b.limbs.len)`.
...@@ -467,7 +467,7 @@ pub const Mutable = struct {...@@ -467,7 +467,7 @@ pub const Mutable = struct {
467 const req_limbs = calcTwosCompLimbCount(bit_count);467 const req_limbs = calcTwosCompLimbCount(bit_count);
468468
469 // Slice of the upper bits if they exist, these will be ignored and allows us to use addCarry to determine469 // Slice of the upper bits if they exist, these will be ignored and allows us to use addCarry to determine
470 // if an overflow occured.470 // if an overflow occurred.
471 const x = Const{471 const x = Const{
472 .positive = a.positive,472 .positive = a.positive,
473 .limbs = a.limbs[0..math.min(req_limbs, a.limbs.len)],473 .limbs = a.limbs[0..math.min(req_limbs, a.limbs.len)],
...@@ -512,7 +512,7 @@ pub const Mutable = struct {...@@ -512,7 +512,7 @@ pub const Mutable = struct {
512 const req_limbs = calcTwosCompLimbCount(bit_count);512 const req_limbs = calcTwosCompLimbCount(bit_count);
513513
514 // Slice of the upper bits if they exist, these will be ignored and allows us to use addCarry to determine514 // Slice of the upper bits if they exist, these will be ignored and allows us to use addCarry to determine
515 // if an overflow occured.515 // if an overflow occurred.
516 const x = Const{516 const x = Const{
517 .positive = a.positive,517 .positive = a.positive,
518 .limbs = a.limbs[0..math.min(req_limbs, a.limbs.len)],518 .limbs = a.limbs[0..math.min(req_limbs, a.limbs.len)],
...@@ -544,7 +544,7 @@ pub const Mutable = struct {...@@ -544,7 +544,7 @@ pub const Mutable = struct {
544 }544 }
545545
546 /// Base implementation for subtraction. Subtracts `max(a.limbs.len, b.limbs.len)` elements from a and b,546 /// Base implementation for subtraction. Subtracts `max(a.limbs.len, b.limbs.len)` elements from a and b,
547 /// and returns whether any overflow occured.547 /// and returns whether any overflow occurred.
548 /// r, a and b may be aliases.548 /// r, a and b may be aliases.
549 ///549 ///
550 /// Asserts r has enough elements to hold the result. The upper bound is `max(a.limbs.len, b.limbs.len)`.550 /// Asserts r has enough elements to hold the result. The upper bound is `max(a.limbs.len, b.limbs.len)`.
...@@ -605,7 +605,7 @@ pub const Mutable = struct {...@@ -605,7 +605,7 @@ pub const Mutable = struct {
605 r.add(a, b.negate());605 r.add(a, b.negate());
606 }606 }
607607
608 /// r = a - b with 2s-complement wrapping semantics. Returns whether any overflow occured.608 /// r = a - b with 2s-complement wrapping semantics. Returns whether any overflow occurred.
609 ///609 ///
610 /// r, a and b may be aliases610 /// r, a and b may be aliases
611 /// Asserts the result fits in `r`. An upper bound on the number of limbs needed by611 /// Asserts the result fits in `r`. An upper bound on the number of limbs needed by
...@@ -1141,7 +1141,7 @@ pub const Mutable = struct {...@@ -1141,7 +1141,7 @@ pub const Mutable = struct {
1141 return;1141 return;
1142 }1142 }
11431143
1144 // Generate a mask with the bits to check in the most signficant limb. We'll need to check1144 // Generate a mask with the bits to check in the most significant limb. We'll need to check
1145 // all bits with equal or more significance than checkbit.1145 // all bits with equal or more significance than checkbit.
1146 // const msb = @truncate(Log2Limb, checkbit);1146 // const msb = @truncate(Log2Limb, checkbit);
1147 // const checkmask = (@as(Limb, 1) << msb) -% 1;1147 // const checkmask = (@as(Limb, 1) << msb) -% 1;
...@@ -2037,7 +2037,7 @@ pub const Const = struct {...@@ -2037,7 +2037,7 @@ pub const Const = struct {
2037 add_res = ov[0];2037 add_res = ov[0];
2038 carry = ov[1];2038 carry = ov[1];
2039 sum += @popCount(add_res);2039 sum += @popCount(add_res);
2040 remaining_bits -= limb_bits; // Asserted not to undeflow by fitsInTwosComp2040 remaining_bits -= limb_bits; // Asserted not to underflow by fitsInTwosComp
2041 }2041 }
20422042
2043 // The most significant limb may have fewer than @bitSizeOf(Limb) meaningful bits,2043 // The most significant limb may have fewer than @bitSizeOf(Limb) meaningful bits,
...@@ -2813,7 +2813,7 @@ pub const Managed = struct {...@@ -2813,7 +2813,7 @@ pub const Managed = struct {
2813 r.setMetadata(m.positive, m.len);2813 r.setMetadata(m.positive, m.len);
2814 }2814 }
28152815
2816 /// r = a + b with 2s-complement wrapping semantics. Returns whether any overflow occured.2816 /// r = a + b with 2s-complement wrapping semantics. Returns whether any overflow occurred.
2817 ///2817 ///
2818 /// r, a and b may be aliases.2818 /// r, a and b may be aliases.
2819 ///2819 ///
...@@ -2856,7 +2856,7 @@ pub const Managed = struct {...@@ -2856,7 +2856,7 @@ pub const Managed = struct {
2856 r.setMetadata(m.positive, m.len);2856 r.setMetadata(m.positive, m.len);
2857 }2857 }
28582858
2859 /// r = a - b with 2s-complement wrapping semantics. Returns whether any overflow occured.2859 /// r = a - b with 2s-complement wrapping semantics. Returns whether any overflow occurred.
2860 ///2860 ///
2861 /// r, a and b may be aliases.2861 /// r, a and b may be aliases.
2862 ///2862 ///
...@@ -4010,7 +4010,7 @@ fn llsquareBasecase(r: []Limb, x: []const Limb) void {...@@ -4010,7 +4010,7 @@ fn llsquareBasecase(r: []Limb, x: []const Limb) void {
4010 assert(r.len >= 2 * x_norm.len + 1);4010 assert(r.len >= 2 * x_norm.len + 1);
40114011
4012 // Compute the square of a N-limb bigint with only (N^2 + N)/24012 // Compute the square of a N-limb bigint with only (N^2 + N)/2
4013 // multiplications by exploting the symmetry of the coefficients around the4013 // multiplications by exploiting the symmetry of the coefficients around the
4014 // diagonal:4014 // diagonal:
4015 //4015 //
4016 // a b c *4016 // a b c *
lib/std/math/complex/tan.zig+1-1
...@@ -4,7 +4,7 @@ const math = std.math;...@@ -4,7 +4,7 @@ const math = std.math;
4const cmath = math.complex;4const cmath = math.complex;
5const Complex = cmath.Complex;5const Complex = cmath.Complex;
66
7/// Returns the tanget of z.7/// Returns the tangent of z.
8pub fn tan(z: anytype) Complex(@TypeOf(z.re)) {8pub fn tan(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);9 const T = @TypeOf(z.re);
10 const q = Complex(T).init(-z.im, z.re);10 const q = Complex(T).init(-z.im, z.re);
lib/std/math/log10.zig+1-1
...@@ -58,7 +58,7 @@ pub fn log10_int(x: anytype) Log2Int(@TypeOf(x)) {...@@ -58,7 +58,7 @@ pub fn log10_int(x: anytype) Log2Int(@TypeOf(x)) {
58 var log: u32 = 0;58 var log: u32 = 0;
5959
60 inline for (0..11) |i| {60 inline for (0..11) |i| {
61 // Unnecesary branches should be removed by the compiler61 // Unnecessary branches should be removed by the compiler
62 if (bit_size > (1 << (11 - i)) * 5 * @log2(10.0) and val >= pow10((1 << (11 - i)) * 5)) {62 if (bit_size > (1 << (11 - i)) * 5 * @log2(10.0) and val >= pow10((1 << (11 - i)) * 5)) {
63 const num_digits = (1 << (11 - i)) * 5;63 const num_digits = (1 << (11 - i)) * 5;
64 val /= pow10(num_digits);64 val /= pow10(num_digits);
lib/std/math/sqrt.zig+1-1
...@@ -11,7 +11,7 @@ const maxInt = std.math.maxInt;...@@ -11,7 +11,7 @@ const maxInt = std.math.maxInt;
11/// - sqrt(+-0) = +-011/// - sqrt(+-0) = +-0
12/// - sqrt(x) = nan if x < 012/// - sqrt(x) = nan if x < 0
13/// - sqrt(nan) = nan13/// - sqrt(nan) = nan
14/// TODO Decide if all this logic should be implemented directly in the @sqrt bultin function.14/// TODO Decide if all this logic should be implemented directly in the @sqrt builtin function.
15pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) {15pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) {
16 const T = @TypeOf(x);16 const T = @TypeOf(x);
17 switch (@typeInfo(T)) {17 switch (@typeInfo(T)) {
lib/std/mem.zig+5-5
...@@ -114,7 +114,7 @@ pub fn validationWrap(allocator: anytype) ValidationAllocator(@TypeOf(allocator)...@@ -114,7 +114,7 @@ pub fn validationWrap(allocator: anytype) ValidationAllocator(@TypeOf(allocator)
114114
115/// An allocator helper function. Adjusts an allocation length satisfy `len_align`.115/// An allocator helper function. Adjusts an allocation length satisfy `len_align`.
116/// `full_len` should be the full capacity of the allocation which may be greater116/// `full_len` should be the full capacity of the allocation which may be greater
117/// than the `len` that was requsted. This function should only be used by allocators117/// than the `len` that was requested. This function should only be used by allocators
118/// that are unaffected by `len_align`.118/// that are unaffected by `len_align`.
119pub fn alignAllocLen(full_len: usize, alloc_len: usize, len_align: u29) usize {119pub fn alignAllocLen(full_len: usize, alloc_len: usize, len_align: u29) usize {
120 assert(alloc_len > 0);120 assert(alloc_len > 0);
...@@ -427,7 +427,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {...@@ -427,7 +427,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
427 .Struct => |init_info| {427 .Struct => |init_info| {
428 if (init_info.is_tuple) {428 if (init_info.is_tuple) {
429 if (init_info.fields.len > struct_info.fields.len) {429 if (init_info.fields.len > struct_info.fields.len) {
430 @compileError("Tuple initializer has more elments than there are fields in `" ++ @typeName(T) ++ "`");430 @compileError("Tuple initializer has more elements than there are fields in `" ++ @typeName(T) ++ "`");
431 }431 }
432 } else {432 } else {
433 inline for (init_info.fields) |field| {433 inline for (init_info.fields) |field| {
...@@ -668,7 +668,7 @@ test "Span" {...@@ -668,7 +668,7 @@ test "Span" {
668668
669/// Takes a sentinel-terminated pointer and returns a slice, iterating over the669/// Takes a sentinel-terminated pointer and returns a slice, iterating over the
670/// memory to find the sentinel and determine the length.670/// memory to find the sentinel and determine the length.
671/// Ponter attributes such as const are preserved.671/// Pointer attributes such as const are preserved.
672/// `[*c]` pointers are assumed to be non-null and 0-terminated.672/// `[*c]` pointers are assumed to be non-null and 0-terminated.
673pub fn span(ptr: anytype) Span(@TypeOf(ptr)) {673pub fn span(ptr: anytype) Span(@TypeOf(ptr)) {
674 if (@typeInfo(@TypeOf(ptr)) == .Optional) {674 if (@typeInfo(@TypeOf(ptr)) == .Optional) {
...@@ -1835,7 +1835,7 @@ test "writeIntBig and writeIntLittle" {...@@ -1835,7 +1835,7 @@ test "writeIntBig and writeIntLittle" {
1835}1835}
18361836
1837/// Swap the byte order of all the members of the fields of a struct1837/// Swap the byte order of all the members of the fields of a struct
1838/// (Changing their endianess)1838/// (Changing their endianness)
1839pub fn byteSwapAllFields(comptime S: type, ptr: *S) void {1839pub fn byteSwapAllFields(comptime S: type, ptr: *S) void {
1840 if (@typeInfo(S) != .Struct) @compileError("byteSwapAllFields expects a struct as the first argument");1840 if (@typeInfo(S) != .Struct) @compileError("byteSwapAllFields expects a struct as the first argument");
1841 inline for (std.meta.fields(S)) |f| {1841 inline for (std.meta.fields(S)) |f| {
...@@ -3168,7 +3168,7 @@ test "replace" {...@@ -3168,7 +3168,7 @@ test "replace" {
3168 try testing.expectEqualStrings(expected, output[0..expected.len]);3168 try testing.expectEqualStrings(expected, output[0..expected.len]);
3169}3169}
31703170
3171/// Replace all occurences of `needle` with `replacement`.3171/// Replace all occurrences of `needle` with `replacement`.
3172pub fn replaceScalar(comptime T: type, slice: []T, needle: T, replacement: T) void {3172pub fn replaceScalar(comptime T: type, slice: []T, needle: T, replacement: T) void {
3173 for (slice, 0..) |e, i| {3173 for (slice, 0..) |e, i| {
3174 if (e == needle) {3174 if (e == needle) {
lib/std/os.zig+3-3
...@@ -659,7 +659,7 @@ pub fn exit(status: u8) noreturn {...@@ -659,7 +659,7 @@ pub fn exit(status: u8) noreturn {
659 linux.exit_group(status);659 linux.exit_group(status);
660 }660 }
661 if (builtin.os.tag == .uefi) {661 if (builtin.os.tag == .uefi) {
662 // exit() is only avaliable if exitBootServices() has not been called yet.662 // exit() is only available if exitBootServices() has not been called yet.
663 // This call to exit should not fail, so we don't care about its return value.663 // This call to exit should not fail, so we don't care about its return value.
664 if (uefi.system_table.boot_services) |bs| {664 if (uefi.system_table.boot_services) |bs| {
665 _ = bs.exit(uefi.handle, @intToEnum(uefi.Status, status), 0, null);665 _ = bs.exit(uefi.handle, @intToEnum(uefi.Status, status), 0, null);
...@@ -2978,7 +2978,7 @@ pub fn chdirZ(dir_path: [*:0]const u8) ChangeCurDirError!void {...@@ -2978,7 +2978,7 @@ pub fn chdirZ(dir_path: [*:0]const u8) ChangeCurDirError!void {
2978 }2978 }
2979}2979}
29802980
2981/// Windows-only. Same as `chdir` except the paramter is WTF16 encoded.2981/// Windows-only. Same as `chdir` except the parameter is WTF16 encoded.
2982pub fn chdirW(dir_path: []const u16) ChangeCurDirError!void {2982pub fn chdirW(dir_path: []const u16) ChangeCurDirError!void {
2983 windows.SetCurrentDirectory(dir_path) catch |err| switch (err) {2983 windows.SetCurrentDirectory(dir_path) catch |err| switch (err) {
2984 error.NoDevice => return error.FileSystem,2984 error.NoDevice => return error.FileSystem,
...@@ -6925,7 +6925,7 @@ pub const PrctlError = error{...@@ -6925,7 +6925,7 @@ pub const PrctlError = error{
6925 /// Can only occur with PR_SET_SPECULATION_CTRL, PR_MPX_ENABLE_MANAGEMENT,6925 /// Can only occur with PR_SET_SPECULATION_CTRL, PR_MPX_ENABLE_MANAGEMENT,
6926 /// or PR_MPX_DISABLE_MANAGEMENT6926 /// or PR_MPX_DISABLE_MANAGEMENT
6927 UnsupportedFeature,6927 UnsupportedFeature,
6928 /// Can only occur wih PR_SET_FP_MODE6928 /// Can only occur with PR_SET_FP_MODE
6929 OperationNotSupported,6929 OperationNotSupported,
6930 PermissionDenied,6930 PermissionDenied,
6931} || UnexpectedError;6931} || UnexpectedError;
lib/std/os/linux.zig+3-3
...@@ -472,7 +472,7 @@ pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: i64) usize {...@@ -472,7 +472,7 @@ pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: i64) usize {
472 @bitCast(usize, @as(isize, fd)),472 @bitCast(usize, @as(isize, fd)),
473 @ptrToInt(iov),473 @ptrToInt(iov),
474 count,474 count,
475 // Kernel expects the offset is splitted into largest natural word-size.475 // Kernel expects the offset is split into largest natural word-size.
476 // See following link for detail:476 // See following link for detail:
477 // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=601cc11d054ae4b5e9b5babec3d8e4667a2cb9b5477 // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=601cc11d054ae4b5e9b5babec3d8e4667a2cb9b5
478 @truncate(usize, offset_u),478 @truncate(usize, offset_u),
...@@ -3912,7 +3912,7 @@ pub const io_uring_cqe = extern struct {...@@ -3912,7 +3912,7 @@ pub const io_uring_cqe = extern struct {
3912/// If set, the upper 16 bits are the buffer ID3912/// If set, the upper 16 bits are the buffer ID
3913pub const IORING_CQE_F_BUFFER = 1 << 0;3913pub const IORING_CQE_F_BUFFER = 1 << 0;
3914/// If set, parent SQE will generate more CQE entries.3914/// If set, parent SQE will generate more CQE entries.
3915/// Avaiable since Linux 5.13.3915/// Available since Linux 5.13.
3916pub const IORING_CQE_F_MORE = 1 << 1;3916pub const IORING_CQE_F_MORE = 1 << 1;
3917/// If set, more data to read after socket recv3917/// If set, more data to read after socket recv
3918pub const IORING_CQE_F_SOCK_NONEMPTY = 1 << 2;3918pub const IORING_CQE_F_SOCK_NONEMPTY = 1 << 2;
...@@ -4234,7 +4234,7 @@ pub const tcp_fastopen_client_fail = enum {...@@ -4234,7 +4234,7 @@ pub const tcp_fastopen_client_fail = enum {
4234pub const TCPI_OPT_TIMESTAMPS = 1;4234pub const TCPI_OPT_TIMESTAMPS = 1;
4235pub const TCPI_OPT_SACK = 2;4235pub const TCPI_OPT_SACK = 2;
4236pub const TCPI_OPT_WSCALE = 4;4236pub const TCPI_OPT_WSCALE = 4;
4237/// ECN was negociated at TCP session init4237/// ECN was negotiated at TCP session init
4238pub const TCPI_OPT_ECN = 8;4238pub const TCPI_OPT_ECN = 8;
4239/// we received at least one packet with ECT4239/// we received at least one packet with ECT
4240pub const TCPI_OPT_ECN_SEEN = 16;4240pub const TCPI_OPT_ECN_SEEN = 16;
lib/std/os/linux/bpf/btf.zig+3-3
...@@ -109,7 +109,7 @@ pub const Enum64 = extern struct {...@@ -109,7 +109,7 @@ pub const Enum64 = extern struct {
109 val_hi32: i32,109 val_hi32: i32,
110};110};
111111
112/// array kind is followd by this struct112/// array kind is followed by this struct
113pub const Array = extern struct {113pub const Array = extern struct {
114 typ: u32,114 typ: u32,
115 index_type: u32,115 index_type: u32,
...@@ -149,13 +149,13 @@ pub const FuncLinkage = enum {...@@ -149,13 +149,13 @@ pub const FuncLinkage = enum {
149 external,149 external,
150};150};
151151
152/// var kind is followd by a single Var struct to describe additional152/// var kind is followed by a single Var struct to describe additional
153/// information related to the variable such as its linkage153/// information related to the variable such as its linkage
154pub const Var = extern struct {154pub const Var = extern struct {
155 linkage: u32,155 linkage: u32,
156};156};
157157
158/// datasec kind is followed by multible VarSecInfo to describe all Var kind158/// datasec kind is followed by multiple VarSecInfo to describe all Var kind
159/// types it contains along with it's in-section offset as well as size.159/// types it contains along with it's in-section offset as well as size.
160pub const VarSecInfo = extern struct {160pub const VarSecInfo = extern struct {
161 typ: u32,161 typ: u32,
lib/std/os/linux/seccomp.zig+1-1
...@@ -65,7 +65,7 @@...@@ -65,7 +65,7 @@
65//!65//!
66//! Unfortunately, there is no easy solution for issue 5. The most reliable66//! Unfortunately, there is no easy solution for issue 5. The most reliable
67//! strategy is to keep testing; test newer Zig versions, different libcs,67//! strategy is to keep testing; test newer Zig versions, different libcs,
68//! different distros, and design your filter to accomidate all of them.68//! different distros, and design your filter to accommodate all of them.
69//! Alternatively, you could inject a filter at runtime. Since filters are69//! Alternatively, you could inject a filter at runtime. Since filters are
70//! preserved across execve(2), a filter could be setup before executing your70//! preserved across execve(2), a filter could be setup before executing your
71//! program, without your program having any knowledge of this happening. This71//! program, without your program having any knowledge of this happening. This
lib/std/os/windows.zig+1-1
...@@ -2114,7 +2114,7 @@ pub fn loadWinsockExtensionFunction(comptime T: type, sock: ws2_32.SOCKET, guid:...@@ -2114,7 +2114,7 @@ pub fn loadWinsockExtensionFunction(comptime T: type, sock: ws2_32.SOCKET, guid:
2114/// and you get an unexpected error.2114/// and you get an unexpected error.
2115pub fn unexpectedError(err: Win32Error) std.os.UnexpectedError {2115pub fn unexpectedError(err: Win32Error) std.os.UnexpectedError {
2116 if (std.os.unexpected_error_tracing) {2116 if (std.os.unexpected_error_tracing) {
2117 // 614 is the length of the longest windows error desciption2117 // 614 is the length of the longest windows error description
2118 var buf_wstr: [614]WCHAR = undefined;2118 var buf_wstr: [614]WCHAR = undefined;
2119 var buf_utf8: [614]u8 = undefined;2119 var buf_utf8: [614]u8 = undefined;
2120 const len = kernel32.FormatMessageW(2120 const len = kernel32.FormatMessageW(
lib/std/packed_int_array.zig+2-2
...@@ -33,7 +33,7 @@ pub fn PackedIntIo(comptime Int: type, comptime endian: Endian) type {...@@ -33,7 +33,7 @@ pub fn PackedIntIo(comptime Int: type, comptime endian: Endian) type {
33 // In the worst case, this is the number of bytes we need to touch33 // In the worst case, this is the number of bytes we need to touch
34 // to read or write a value, as bits. To calculate for int_bits > 1,34 // to read or write a value, as bits. To calculate for int_bits > 1,
35 // set aside 2 bits to touch the first and last bytes, then divide35 // set aside 2 bits to touch the first and last bytes, then divide
36 // by 8 to see how many bytes can be filled up inbetween.36 // by 8 to see how many bytes can be filled up in between.
37 const max_io_bits = switch (int_bits) {37 const max_io_bits = switch (int_bits) {
38 0 => 0,38 0 => 0,
39 1 => 8,39 1 => 8,
...@@ -298,7 +298,7 @@ pub fn PackedIntSliceEndian(comptime Int: type, comptime endian: Endian) type {...@@ -298,7 +298,7 @@ pub fn PackedIntSliceEndian(comptime Int: type, comptime endian: Endian) type {
298 }298 }
299299
300 /// Initialize a packed slice using the memory at `bytes`, with `int_count`300 /// Initialize a packed slice using the memory at `bytes`, with `int_count`
301 /// elements. `bytes` must be large enough to accomodate the requested301 /// elements. `bytes` must be large enough to accommodate the requested
302 /// count.302 /// count.
303 pub fn init(bytes: []u8, int_count: usize) Self {303 pub fn init(bytes: []u8, int_count: usize) Self {
304 debug.assert(bytes.len >= bytesRequired(int_count));304 debug.assert(bytes.len >= bytesRequired(int_count));
lib/std/pdb.zig+1-1
...@@ -912,7 +912,7 @@ const Msf = struct {...@@ -912,7 +912,7 @@ const Msf = struct {
912 const stream_sizes = try allocator.alloc(u32, stream_count);912 const stream_sizes = try allocator.alloc(u32, stream_count);
913 defer allocator.free(stream_sizes);913 defer allocator.free(stream_sizes);
914914
915 // Microsoft's implementation uses @as(u32, -1) for inexistant streams.915 // Microsoft's implementation uses @as(u32, -1) for inexistent streams.
916 // These streams are not used, but still participate in the file916 // These streams are not used, but still participate in the file
917 // and must be taken into account when resolving stream indices.917 // and must be taken into account when resolving stream indices.
918 const Nil = 0xFFFFFFFF;918 const Nil = 0xFFFFFFFF;
lib/std/simd.zig+1-1
...@@ -159,7 +159,7 @@ pub fn interlace(vecs: anytype) @Vector(vectorLength(@TypeOf(vecs[0])) * vecs.le...@@ -159,7 +159,7 @@ pub fn interlace(vecs: anytype) @Vector(vectorLength(@TypeOf(vecs[0])) * vecs.le
159}159}
160160
161/// The contents of `interlaced` is evenly split between vec_count vectors that are returned as an array. They "take turns",161/// The contents of `interlaced` is evenly split between vec_count vectors that are returned as an array. They "take turns",
162/// recieving one element from `interlaced` at a time.162/// receiving one element from `interlaced` at a time.
163pub fn deinterlace(163pub fn deinterlace(
164 comptime vec_count: usize,164 comptime vec_count: usize,
165 interlaced: anytype,165 interlaced: anytype,
lib/std/target/csky.zig+7-7
...@@ -214,7 +214,7 @@ pub const all_features = blk: {...@@ -214,7 +214,7 @@ pub const all_features = blk: {
214 };214 };
215 result[@enumToInt(Feature.dsp_silan)] = .{215 result[@enumToInt(Feature.dsp_silan)] = .{
216 .llvm_name = "dsp_silan",216 .llvm_name = "dsp_silan",
217 .description = "Enable DSP Silan instrutions",217 .description = "Enable DSP Silan instructions",
218 .dependencies = featureSet(&[_]Feature{}),218 .dependencies = featureSet(&[_]Feature{}),
219 };219 };
220 result[@enumToInt(Feature.dspe60)] = .{220 result[@enumToInt(Feature.dspe60)] = .{
...@@ -224,7 +224,7 @@ pub const all_features = blk: {...@@ -224,7 +224,7 @@ pub const all_features = blk: {
224 };224 };
225 result[@enumToInt(Feature.dspv2)] = .{225 result[@enumToInt(Feature.dspv2)] = .{
226 .llvm_name = "dspv2",226 .llvm_name = "dspv2",
227 .description = "Enable DSP V2.0 instrutions",227 .description = "Enable DSP V2.0 instructions",
228 .dependencies = featureSet(&[_]Feature{}),228 .dependencies = featureSet(&[_]Feature{}),
229 };229 };
230 result[@enumToInt(Feature.e1)] = .{230 result[@enumToInt(Feature.e1)] = .{
...@@ -243,7 +243,7 @@ pub const all_features = blk: {...@@ -243,7 +243,7 @@ pub const all_features = blk: {
243 };243 };
244 result[@enumToInt(Feature.edsp)] = .{244 result[@enumToInt(Feature.edsp)] = .{
245 .llvm_name = "edsp",245 .llvm_name = "edsp",
246 .description = "Enable DSP instrutions",246 .description = "Enable DSP instructions",
247 .dependencies = featureSet(&[_]Feature{}),247 .dependencies = featureSet(&[_]Feature{}),
248 };248 };
249 result[@enumToInt(Feature.elrw)] = .{249 result[@enumToInt(Feature.elrw)] = .{
...@@ -333,12 +333,12 @@ pub const all_features = blk: {...@@ -333,12 +333,12 @@ pub const all_features = blk: {
333 };333 };
334 result[@enumToInt(Feature.hwdiv)] = .{334 result[@enumToInt(Feature.hwdiv)] = .{
335 .llvm_name = "hwdiv",335 .llvm_name = "hwdiv",
336 .description = "Enable divide instrutions",336 .description = "Enable divide instructions",
337 .dependencies = featureSet(&[_]Feature{}),337 .dependencies = featureSet(&[_]Feature{}),
338 };338 };
339 result[@enumToInt(Feature.istack)] = .{339 result[@enumToInt(Feature.istack)] = .{
340 .llvm_name = "istack",340 .llvm_name = "istack",
341 .description = "Enable interrput attribute",341 .description = "Enable interrupt attribute",
342 .dependencies = featureSet(&[_]Feature{}),342 .dependencies = featureSet(&[_]Feature{}),
343 };343 };
344 result[@enumToInt(Feature.java)] = .{344 result[@enumToInt(Feature.java)] = .{
...@@ -362,7 +362,7 @@ pub const all_features = blk: {...@@ -362,7 +362,7 @@ pub const all_features = blk: {
362 };362 };
363 result[@enumToInt(Feature.multiple_stld)] = .{363 result[@enumToInt(Feature.multiple_stld)] = .{
364 .llvm_name = "multiple_stld",364 .llvm_name = "multiple_stld",
365 .description = "Enable multiple load/store instrutions",365 .description = "Enable multiple load/store instructions",
366 .dependencies = featureSet(&[_]Feature{}),366 .dependencies = featureSet(&[_]Feature{}),
367 };367 };
368 result[@enumToInt(Feature.nvic)] = .{368 result[@enumToInt(Feature.nvic)] = .{
...@@ -372,7 +372,7 @@ pub const all_features = blk: {...@@ -372,7 +372,7 @@ pub const all_features = blk: {
372 };372 };
373 result[@enumToInt(Feature.pushpop)] = .{373 result[@enumToInt(Feature.pushpop)] = .{
374 .llvm_name = "pushpop",374 .llvm_name = "pushpop",
375 .description = "Enable push/pop instrutions",375 .description = "Enable push/pop instructions",
376 .dependencies = featureSet(&[_]Feature{}),376 .dependencies = featureSet(&[_]Feature{}),
377 };377 };
378 result[@enumToInt(Feature.smart)] = .{378 result[@enumToInt(Feature.smart)] = .{
lib/std/time.zig+1-1
...@@ -258,7 +258,7 @@ pub const Instant = struct {...@@ -258,7 +258,7 @@ pub const Instant = struct {
258258
259/// A monotonic, high performance timer.259/// A monotonic, high performance timer.
260///260///
261/// Timer.start() is used to initalize the timer261/// Timer.start() is used to initialize the timer
262/// and gives the caller an opportunity to check for the existence of a supported clock.262/// and gives the caller an opportunity to check for the existence of a supported clock.
263/// Once a supported clock is discovered,263/// Once a supported clock is discovered,
264/// it is assumed that it will be available for the duration of the Timer's use.264/// it is assumed that it will be available for the duration of the Timer's use.
lib/std/valgrind/memcheck.zig+2-2
...@@ -77,7 +77,7 @@ pub fn discard(blkindex: usize) bool {...@@ -77,7 +77,7 @@ pub fn discard(blkindex: usize) bool {
77}77}
7878
79/// Check that memory at qzz.ptr is addressable for qzz.len bytes.79/// Check that memory at qzz.ptr is addressable for qzz.len bytes.
80/// If suitable addressibility is not established, Valgrind prints an80/// If suitable addressability is not established, Valgrind prints an
81/// error message and returns the address of the first offending byte.81/// error message and returns the address of the first offending byte.
82/// Otherwise it returns zero.82/// Otherwise it returns zero.
83pub fn checkMemIsAddressable(qzz: []u8) usize {83pub fn checkMemIsAddressable(qzz: []u8) usize {
...@@ -85,7 +85,7 @@ pub fn checkMemIsAddressable(qzz: []u8) usize {...@@ -85,7 +85,7 @@ pub fn checkMemIsAddressable(qzz: []u8) usize {
85}85}
8686
87/// Check that memory at qzz.ptr is addressable and defined for87/// Check that memory at qzz.ptr is addressable and defined for
88/// qzz.len bytes. If suitable addressibility and definedness are not88/// qzz.len bytes. If suitable addressability and definedness are not
89/// established, Valgrind prints an error message and returns the89/// established, Valgrind prints an error message and returns the
90/// address of the first offending byte. Otherwise it returns zero.90/// address of the first offending byte. Otherwise it returns zero.
91pub fn checkMemIsDefined(qzz: []u8) usize {91pub fn checkMemIsDefined(qzz: []u8) usize {
lib/std/zig/parser_test.zig+3-3
...@@ -239,7 +239,7 @@ test "zig fmt: file ends in comment after var decl" {...@@ -239,7 +239,7 @@ test "zig fmt: file ends in comment after var decl" {
239 );239 );
240}240}
241241
242test "zig fmt: if statment" {242test "zig fmt: if statement" {
243 try testCanonical(243 try testCanonical(
244 \\test "" {244 \\test "" {
245 \\ if (optional()) |some|245 \\ if (optional()) |some|
...@@ -529,7 +529,7 @@ test "zig fmt: remove empty lines at start/end of block" {...@@ -529,7 +529,7 @@ test "zig fmt: remove empty lines at start/end of block" {
529 );529 );
530}530}
531531
532test "zig fmt: allow empty line before commment at start of block" {532test "zig fmt: allow empty line before comment at start of block" {
533 try testCanonical(533 try testCanonical(
534 \\test {534 \\test {
535 \\535 \\
...@@ -4371,7 +4371,7 @@ test "zig fmt: same line doc comment returns error" {...@@ -4371,7 +4371,7 @@ test "zig fmt: same line doc comment returns error" {
4371 \\const Foo = struct{4371 \\const Foo = struct{
4372 \\ bar: u32, /// comment4372 \\ bar: u32, /// comment
4373 \\ foo: u32, /// comment4373 \\ foo: u32, /// comment
4374 \\ /// commment4374 \\ /// comment
4375 \\};4375 \\};
4376 \\4376 \\
4377 \\const a = 42; /// comment4377 \\const a = 42; /// comment
lib/std/zig/render.zig+1-1
...@@ -681,7 +681,7 @@ fn renderExpression(gpa: Allocator, ais: *Ais, tree: Ast, node: Ast.Node.Index,...@@ -681,7 +681,7 @@ fn renderExpression(gpa: Allocator, ais: *Ais, tree: Ast, node: Ast.Node.Index,
681681
682 try renderToken(ais, tree, switch_token, .space); // switch keyword682 try renderToken(ais, tree, switch_token, .space); // switch keyword
683 try renderToken(ais, tree, switch_token + 1, .none); // lparen683 try renderToken(ais, tree, switch_token + 1, .none); // lparen
684 try renderExpression(gpa, ais, tree, condition, .none); // condtion expression684 try renderExpression(gpa, ais, tree, condition, .none); // condition expression
685 try renderToken(ais, tree, rparen, .space); // rparen685 try renderToken(ais, tree, rparen, .space); // rparen
686686
687 ais.pushIndentNextLine();687 ais.pushIndentNextLine();