diff options
| author | Kenta Iwasaki <kenta@lithdew.net> | 2021-05-18 17:23:59 +0900 |
|---|---|---|
| committer | Kenta Iwasaki <kenta@lithdew.net> | 2021-06-01 18:23:54 +0900 |
| commit | 7b6ec3e3548dadc597b6aa396d70ba4c6595da26 (patch) | |
| tree | 729277affbd435d8fa8e90e5e460af63ae6f82af /lib | |
| parent | 9ba65592d64f53d886b00402659cfce775ea77d3 (diff) | |
| download | zig-7b6ec3e3548dadc597b6aa396d70ba4c6595da26.tar.gz zig-7b6ec3e3548dadc597b6aa396d70ba4c6595da26.zip | |
x/os: {read, write}Vectorized() -> {read, write}Message()
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/json.zig | 5 | ||||
| -rw-r--r-- | lib/std/x/net/tcp.zig | 12 | ||||
| -rw-r--r-- | lib/std/x/os/socket_posix.zig | 4 | ||||
| -rw-r--r-- | lib/std/x/os/socket_windows.zig | 4 |
4 files changed, 11 insertions, 14 deletions
diff --git a/lib/std/json.zig b/lib/std/json.zig index 9fb77d501f..ed90efb791 100644 --- a/lib/std/json.zig +++ b/lib/std/json.zig @@ -2111,10 +2111,7 @@ test "parse into struct with duplicate field" { const ballast = try testing.allocator.alloc(u64, 1); defer testing.allocator.free(ballast); - const options_first = ParseOptions{ - .allocator = testing.allocator, - .duplicate_field_behavior = .UseFirst, - }; + const options_first = ParseOptions{ .allocator = testing.allocator, .duplicate_field_behavior = .UseFirst }; const options_last = ParseOptions{ .allocator = testing.allocator, diff --git a/lib/std/x/net/tcp.zig b/lib/std/x/net/tcp.zig index 05b0f50c10..8740c17e61 100644 --- a/lib/std/x/net/tcp.zig +++ b/lib/std/x/net/tcp.zig @@ -145,15 +145,15 @@ pub const Client = struct { /// Writes multiple I/O vectors with a prepended message header to the socket /// with a set of flags specified. It returns the number of bytes that are /// written to the socket. - pub fn writeVectorized(self: Client, msg: Socket.Message, flags: u32) !usize { - return self.socket.writeVectorized(msg, flags); + pub fn writeMessage(self: Client, msg: Socket.Message, flags: u32) !usize { + return self.socket.writeMessage(msg, flags); } /// Read multiple I/O vectors with a prepended message header from the socket /// with a set of flags specified. It returns the number of bytes that were /// read into the buffer provided. - pub fn readVectorized(self: Client, msg: *Socket.Message, flags: u32) !usize { - return self.socket.readVectorized(msg, flags); + pub fn readMessage(self: Client, msg: *Socket.Message, flags: u32) !usize { + return self.socket.readMessage(msg, flags); } /// Query and return the latest cached error on the client's underlying socket. @@ -400,7 +400,7 @@ test "tcp/client: read and write multiple vectors" { defer conn.deinit(); const message = "hello world"; - _ = try conn.client.writeVectorized(Socket.Message.fromBuffers(&[_]Buffer{ + _ = try conn.client.writeMessage(Socket.Message.fromBuffers(&[_]Buffer{ Buffer.from(message[0 .. message.len / 2]), Buffer.from(message[message.len / 2 ..]), }), 0); @@ -410,7 +410,7 @@ test "tcp/client: read and write multiple vectors" { Buffer.from(buf[0 .. message.len / 2]), Buffer.from(buf[message.len / 2 ..]), }); - _ = try client.readVectorized(&msg, 0); + _ = try client.readMessage(&msg, 0); try testing.expectEqualStrings(message, buf[0..message.len]); } diff --git a/lib/std/x/os/socket_posix.zig b/lib/std/x/os/socket_posix.zig index 70c8b35b5f..ebaadcbd5d 100644 --- a/lib/std/x/os/socket_posix.zig +++ b/lib/std/x/os/socket_posix.zig @@ -78,14 +78,14 @@ pub fn Mixin(comptime Socket: type) type { /// Writes multiple I/O vectors with a prepended message header to the socket /// with a set of flags specified. It returns the number of bytes that are /// written to the socket. - pub fn writeVectorized(self: Socket, msg: Socket.Message, flags: u32) !usize { + pub fn writeMessage(self: Socket, msg: Socket.Message, flags: u32) !usize { return os.sendmsg(self.fd, msg, flags); } /// Read multiple I/O vectors with a prepended message header from the socket /// with a set of flags specified. It returns the number of bytes that were /// read into the buffer provided. - pub fn readVectorized(self: Socket, msg: *Socket.Message, flags: u32) !usize { + pub fn readMessage(self: Socket, msg: *Socket.Message, flags: u32) !usize { while (true) { const rc = os.system.recvmsg(self.fd, msg, @intCast(c_int, flags)); return switch (os.errno(rc)) { diff --git a/lib/std/x/os/socket_windows.zig b/lib/std/x/os/socket_windows.zig index ed1db4f62f..d479d8619a 100644 --- a/lib/std/x/os/socket_windows.zig +++ b/lib/std/x/os/socket_windows.zig @@ -254,7 +254,7 @@ pub fn Mixin(comptime Socket: type) type { /// Writes multiple I/O vectors with a prepended message header to the socket /// with a set of flags specified. It returns the number of bytes that are /// written to the socket. - pub fn writeVectorized(self: Socket, msg: Socket.Message, flags: u32) !usize { + pub fn writeMessage(self: Socket, msg: Socket.Message, flags: u32) !usize { const call = try windows.loadWinsockExtensionFunction(ws2_32.LPFN_WSASENDMSG, self.fd, ws2_32.WSAID_WSASENDMSG); var num_bytes: u32 = undefined; @@ -291,7 +291,7 @@ pub fn Mixin(comptime Socket: type) type { /// Read multiple I/O vectors with a prepended message header from the socket /// with a set of flags specified. It returns the number of bytes that were /// read into the buffer provided. - pub fn readVectorized(self: Socket, msg: *Socket.Message, flags: u32) !usize { + pub fn readMessage(self: Socket, msg: *Socket.Message, flags: u32) !usize { const call = try windows.loadWinsockExtensionFunction(ws2_32.LPFN_WSARECVMSG, self.fd, ws2_32.WSAID_WSARECVMSG); var num_bytes: u32 = undefined; |
