authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-04 23:04:20-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-04 23:04:20-07:00
logd159ba9295b331663a62438673f3543c35fca136
tree87f19fb904d8706b6b8368b849be44f1ce0e26bd
parentf23fb3087befc041161498a086bac2a92acea6cb

zig fmt


6 files changed, 14 insertions(+), 15 deletions(-)

lib/std/json.zig+1-1
......@@ -1742,7 +1742,7 @@ test "parse into tagged union" {
17421742 A: struct { x: u32 },
17431743 B: struct { y: u32 },
17441744 };
1745 testing.expectEqual(T{ .B = .{.y = 42} }, try parse(T, &TokenStream.init("{\"y\":42}"), ParseOptions{}));
1745 testing.expectEqual(T{ .B = .{ .y = 42 } }, try parse(T, &TokenStream.init("{\"y\":42}"), ParseOptions{}));
17461746 }
17471747}
17481748
lib/std/mem.zig+1-1
......@@ -2038,7 +2038,7 @@ pub fn replace(comptime T: type, input: []const T, needle: []const T, replacemen
20382038 var replacements: usize = 0;
20392039 while (slide < input.len) {
20402040 if (mem.indexOf(T, input[slide..], needle) == @as(usize, 0)) {
2041 mem.copy(T, output[i..i + replacement.len], replacement);
2041 mem.copy(T, output[i .. i + replacement.len], replacement);
20422042 i += replacement.len;
20432043 slide += needle.len;
20442044 replacements += 1;
lib/std/net.zig+9-10
......@@ -77,23 +77,23 @@ pub const Address = extern union {
7777 }
7878
7979 pub fn parseIp6(buf: []const u8, port: u16) !Address {
80 return Address{.in6 = try Ip6Address.parse(buf, port) };
80 return Address{ .in6 = try Ip6Address.parse(buf, port) };
8181 }
8282
8383 pub fn resolveIp6(buf: []const u8, port: u16) !Address {
84 return Address{.in6 = try Ip6Address.resolve(buf, port) };
84 return Address{ .in6 = try Ip6Address.resolve(buf, port) };
8585 }
8686
8787 pub fn parseIp4(buf: []const u8, port: u16) !Address {
88 return Address {.in = try Ip4Address.parse(buf, port) };
88 return Address{ .in = try Ip4Address.parse(buf, port) };
8989 }
9090
9191 pub fn initIp4(addr: [4]u8, port: u16) Address {
92 return Address{.in = Ip4Address.init(addr, port) };
92 return Address{ .in = Ip4Address.init(addr, port) };
9393 }
9494
9595 pub fn initIp6(addr: [16]u8, port: u16, flowinfo: u32, scope_id: u32) Address {
96 return Address{.in6 = Ip6Address.init(addr, port, flowinfo, scope_id) };
96 return Address{ .in6 = Ip6Address.init(addr, port, flowinfo, scope_id) };
9797 }
9898
9999 pub fn initUnix(path: []const u8) !Address {
......@@ -136,8 +136,8 @@ pub const Address = extern union {
136136 /// on the address family.
137137 pub fn initPosix(addr: *align(4) const os.sockaddr) Address {
138138 switch (addr.family) {
139 os.AF_INET => return Address{ .in = Ip4Address{ .sa = @ptrCast(*const os.sockaddr_in, addr).*} },
140 os.AF_INET6 => return Address{ .in6 = Ip6Address{ .sa = @ptrCast(*const os.sockaddr_in6, addr).*} },
139 os.AF_INET => return Address{ .in = Ip4Address{ .sa = @ptrCast(*const os.sockaddr_in, addr).* } },
140 os.AF_INET6 => return Address{ .in6 = Ip6Address{ .sa = @ptrCast(*const os.sockaddr_in6, addr).* } },
141141 else => unreachable,
142142 }
143143 }
......@@ -193,7 +193,7 @@ pub const Ip4Address = extern struct {
193193 .sa = .{
194194 .port = mem.nativeToBig(u16, port),
195195 .addr = undefined,
196 }
196 },
197197 };
198198 const out_ptr = mem.sliceAsBytes(@as(*[1]u32, &result.sa.addr)[0..]);
199199
......@@ -240,7 +240,7 @@ pub const Ip4Address = extern struct {
240240 }
241241
242242 pub fn init(addr: [4]u8, port: u16) Ip4Address {
243 return Ip4Address {
243 return Ip4Address{
244244 .sa = os.sockaddr_in{
245245 .port = mem.nativeToBig(u16, port),
246246 .addr = @ptrCast(*align(1) const u32, &addr).*,
......@@ -598,7 +598,6 @@ pub const Ip6Address = extern struct {
598598 }
599599};
600600
601
602601pub fn connectUnixSocket(path: []const u8) !fs.File {
603602 const opt_non_block = if (std.io.is_async) os.SOCK_NONBLOCK else 0;
604603 const sockfd = try os.socket(
lib/std/os/bits/windows.zig+1-1
......@@ -261,4 +261,4 @@ pub const O_LARGEFILE = 0;
261261pub const O_NOATIME = 0o1000000;
262262pub const O_PATH = 0o10000000;
263263pub const O_TMPFILE = 0o20200000;
264pub const O_NDELAY = O_NONBLOCK;
\ No newline at end of file
264pub const O_NDELAY = O_NONBLOCK;
lib/std/os/windows.zig+1-1
......@@ -51,7 +51,7 @@ pub const OpenFileOptions = struct {
5151 open_dir: bool = false,
5252 /// If false, tries to open path as a reparse point without dereferencing it.
5353 /// Defaults to true.
54 follow_symlinks: bool = true,
54 follow_symlinks: bool = true,
5555};
5656
5757/// TODO when share_access_nonblocking is false, this implementation uses
lib/std/special/compiler_rt/floatditf.zig+1-1
......@@ -18,7 +18,7 @@ pub fn __floatditf(arg: i64) callconv(.C) f128 {
1818 var aAbs = @bitCast(u64, arg);
1919 if (arg < 0) {
2020 sign = 1 << 127;
21 aAbs = ~@bitCast(u64, arg)+ 1;
21 aAbs = ~@bitCast(u64, arg) + 1;
2222 }
2323
2424 // Exponent of (fp_t)a is the width of abs(a).