diff --git a/src/env.cpp b/src/env.cpp index 6d7143b42..ba85aaada 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -33,6 +33,7 @@ #include "proc.h" #include "reader.h" #include "termsize.h" +#include "wcstringutil.h" #include "wutil.h" // IWYU pragma: keep /// Some configuration path environment variables. diff --git a/src/exec.cpp b/src/exec.cpp index af7f11085..57393b24f 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -48,6 +48,7 @@ #include "signal.h" #include "timer.h" #include "trace.h" +#include "wcstringutil.h" #include "wutil.h" // IWYU pragma: keep /// Number of calls to fork() or posix_spawn(). diff --git a/src/flog.cpp b/src/flog.cpp index 1a64ef228..d1e8b076a 100644 --- a/src/flog.cpp +++ b/src/flog.cpp @@ -46,6 +46,10 @@ void logger_t::log1(wchar_t c) { std::fputwc(c, file_); } void logger_t::log1(char c) { std::fwprintf(file_, L"%c", c); } +void logger_t::log1(int64_t v) { std::fwprintf(file_, L"%lld", v); } + +void logger_t::log1(uint64_t v) { std::fwprintf(file_, L"%llu", v); } + void logger_t::log_fmt(const category_t &cat, const wchar_t *fmt, ...) { va_list va; va_start(va, fmt); diff --git a/src/flog.h b/src/flog.h index eed0c0771..30bdb4cb8 100644 --- a/src/flog.h +++ b/src/flog.h @@ -11,7 +11,6 @@ #include #include "global_safety.h" -#include "wcstringutil.h" using wcstring = std::wstring; using wcstring_list_t = std::vector; @@ -115,14 +114,20 @@ class logger_t { void log1(const char *); void log1(wchar_t); void log1(char); + void log1(int64_t); + void log1(uint64_t); void log1(const wcstring &s) { log1(s.c_str()); } void log1(const std::string &s) { log1(s.c_str()); } template ::value>::type> - void log1(const T &v) { - log1(to_string(v)); + void log1(T v) { + if (std::is_signed::value) { + log1(static_cast(v)); + } else { + log1(static_cast(v)); + } } template diff --git a/src/path.cpp b/src/path.cpp index 570d06a44..79f7ad980 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -21,6 +21,7 @@ #include "expand.h" #include "fallback.h" // IWYU pragma: keep #include "flog.h" +#include "wcstringutil.h" #include "wutil.h" // IWYU pragma: keep /// Unexpected error in path_get_path(). diff --git a/src/proc.cpp b/src/proc.cpp index a44ef90d8..e09ba5825 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -51,6 +51,7 @@ #include "reader.h" #include "sanity.h" #include "signal.h" +#include "wcstringutil.h" #include "wutil.h" // IWYU pragma: keep /// The signals that signify crashes to us. diff --git a/src/termsize.cpp b/src/termsize.cpp index 905d922ff..cf3591adf 100644 --- a/src/termsize.cpp +++ b/src/termsize.cpp @@ -4,6 +4,7 @@ #include "maybe.h" #include "parser.h" +#include "wcstringutil.h" #include "wutil.h" // A counter which is incremented every SIGWINCH, or when the tty is otherwise invalidated. diff --git a/src/wutil.cpp b/src/wutil.cpp index c79c3073d..f046acfac 100644 --- a/src/wutil.cpp +++ b/src/wutil.cpp @@ -29,6 +29,7 @@ #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "flog.h" +#include "wcstringutil.h" #include "wutil.h" // IWYU pragma: keep using cstring = std::string;