From 4a365d974b17f71914909df8fe532edc929f3cad Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 18 Jun 2026 09:05:34 +0200 Subject: chore: clean up code --- ttwhy/io.cppm | 1 - ttwhy/main.cpp | 2 +- ttwhy/scoped_attributes.cppm | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ttwhy/io.cppm b/ttwhy/io.cppm index 353bdfa..230f180 100644 --- a/ttwhy/io.cppm +++ b/ttwhy/io.cppm @@ -4,7 +4,6 @@ module; #include #include -#include export module ttwhy:io; diff --git a/ttwhy/main.cpp b/ttwhy/main.cpp index 649d01d..94c1330 100644 --- a/ttwhy/main.cpp +++ b/ttwhy/main.cpp @@ -35,7 +35,7 @@ auto main() -> int .echo(false); auto context = asio::io_context{}; - asio::co_spawn(context, app(fileno(stdin), fileno(stdout), fileno(stderr)), asio::detached); + asio::co_spawn(context, app(::fileno(::stdin), ::fileno(::stdout), ::fileno(::stderr)), asio::detached); context.run(); } diff --git a/ttwhy/scoped_attributes.cppm b/ttwhy/scoped_attributes.cppm index 243d4ac..c68ab01 100644 --- a/ttwhy/scoped_attributes.cppm +++ b/ttwhy/scoped_attributes.cppm @@ -15,7 +15,7 @@ namespace ttwhy auto static read_attributes(int file_descriptor) -> termios { auto active_attributes = termios{}; - if (tcgetattr(file_descriptor, &active_attributes)) + if (::tcgetattr(file_descriptor, &active_attributes)) { throw std::system_error(errno, std::system_category(), "failed to read termios attributes"); } @@ -46,7 +46,7 @@ namespace ttwhy active_attributes.c_lflag = active_attributes.c_lflag & ~flag; } - if (tcsetattr(file_descriptor, TCSANOW, &active_attributes)) + if (::tcsetattr(file_descriptor, TCSANOW, &active_attributes)) { throw std::system_error(errno, std::system_category(), "failed to write termios attributes"); } @@ -56,7 +56,7 @@ namespace ttwhy export struct scoped_attributes { explicit scoped_attributes(int file_descriptor) - : m_file_descriptor{dup(file_descriptor)} + : m_file_descriptor{::dup(file_descriptor)} , m_attributes{read_attributes(file_descriptor)} {} @@ -71,8 +71,8 @@ namespace ttwhy { if (m_file_descriptor > 0) { - tcsetattr(m_file_descriptor, TCSANOW, &m_attributes); - close(m_file_descriptor); + ::tcsetattr(m_file_descriptor, TCSANOW, &m_attributes); + ::close(m_file_descriptor); } } -- cgit v1.2.3