From 381b34f7316a1fcafdb651edd9b51304e806acbc Mon Sep 17 00:00:00 2001 From: blankie Date: Mon, 16 Jan 2023 11:05:25 +0700 Subject: [PATCH] Add misc.cpp --- config.cpp | 1 + log.cpp | 9 --------- log.h | 1 - misc.cpp | 10 ++++++++++ misc.h | 5 +++++ 5 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 misc.cpp create mode 100644 misc.h diff --git a/config.cpp b/config.cpp index a23ac44..9d0693d 100644 --- a/config.cpp +++ b/config.cpp @@ -9,6 +9,7 @@ #include #include "log.h" +#include "misc.h" #include "config.h" static FILE* fopen_or_raise(const char* path, const char* mode, bool ignore_enoent) { diff --git a/log.cpp b/log.cpp index 78f2133..7da6e4a 100644 --- a/log.cpp +++ b/log.cpp @@ -1,9 +1,6 @@ #include #include #include -#include -#include -#include #include #include @@ -40,9 +37,3 @@ void log(std::string action, const std::exception& e, time_t time) { void log(std::string action, const std::exception& e) { log(std::move(action), e, time(nullptr)); } - -std::string quote(const std::string& str) { - std::stringstream ss; - ss << std::quoted(str); - return ss.str(); -} diff --git a/log.h b/log.h index e3fee54..3d70c78 100644 --- a/log.h +++ b/log.h @@ -10,4 +10,3 @@ void log(std::string entry, time_t time); void log(std::string entry); void log(std::string action, const std::exception& e, time_t time); void log(std::string action, const std::exception& e); -std::string quote(const std::string& str); diff --git a/misc.cpp b/misc.cpp new file mode 100644 index 0000000..d23cb3b --- /dev/null +++ b/misc.cpp @@ -0,0 +1,10 @@ +#include +#include + +#include "misc.h" + +std::string quote(const std::string& str) { + std::stringstream ss; + ss << std::quoted(str); + return ss.str(); +} diff --git a/misc.h b/misc.h new file mode 100644 index 0000000..1e75a5a --- /dev/null +++ b/misc.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +std::string quote(const std::string& str);