From 17bfb0ef0a48330b1d54e61fe3c30d83528d2d90 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 25 Jan 2023 20:16:22 +0100 Subject: style: typedef structs, shorter namespaces I've wanted to do this for a while, and since I've just had a relatively large refactor commit (pcpy), this is as good of a time as any. Typedefing structs was mostly inspired by Plan 9's coding style. It makes some lines of code much shorter at basically no expense. Everything related to userland kept old-style struct definitions, so as not to force that style onto other people. I also considered changing SCREAMING_ENUM_FIELDS to NicerLookingCamelcase, but I didn't, just in case that'd be confusing. --- src/user/app/netdog/nd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/user/app/netdog/nd.c') diff --git a/src/user/app/netdog/nd.c b/src/user/app/netdog/nd.c index 93e1d3a..fdc8361 100644 --- a/src/user/app/netdog/nd.c +++ b/src/user/app/netdog/nd.c @@ -6,15 +6,15 @@ #define eprintf(fmt, ...) fprintf(stderr, "netdog: "fmt"\n" __VA_OPT__(,) __VA_ARGS__) -handle_t conn; +hid_t conn; void send_stdin(void *arg) { (void)arg; static char buf[4096]; for (;;) { // TODO define STDIN_FILENO - long ret = _syscall_read(0, buf, sizeof buf, -1); + long ret = _sys_read(0, buf, sizeof buf, -1); if (ret <= 0) return; /* instead of sending an empty packet, quit. */ - ret = _syscall_write(conn, buf, ret, -1, 0); + ret = _sys_write(conn, buf, ret, -1, 0); if (ret < 0) return; } } @@ -22,9 +22,9 @@ void send_stdin(void *arg) { (void)arg; void recv_stdout(void *arg) { (void)arg; static char buf[4096]; for (;;) { - long ret = _syscall_read(conn, buf, sizeof buf, -1); + long ret = _sys_read(conn, buf, sizeof buf, -1); if (ret < 0) return; - ret = _syscall_write(1, buf, ret, -1, 0); + ret = _sys_write(1, buf, ret, -1, 0); if (ret < 0) return; } } @@ -43,6 +43,6 @@ int main(int argc, char **argv) { thread_create(0, send_stdin, NULL); thread_create(0, recv_stdout, NULL); - _syscall_await(); + _sys_await(); return 0; } -- cgit v1.2.3