From 4057d7e216618e33003471f1b8cdea866f86451b Mon Sep 17 00:00:00 2001 From: Tindy X <49061470+tindy2013@users.noreply.github.com> Date: Tue, 3 Dec 2019 21:36:49 +0800 Subject: [PATCH] Bug fixes Fix compile error on MacOS. Speed up generation of Clash configuration. --- misc.cpp | 7 ------- misc.h | 1 - subexport.cpp | 2 +- webserver_libevent.cpp | 2 ++ 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/misc.cpp b/misc.cpp index 6f3a20c..8169ab2 100644 --- a/misc.cpp +++ b/misc.cpp @@ -759,13 +759,6 @@ void shortDisassemble(int source, unsigned short &num_a, unsigned short &num_b) num_b = (unsigned short)(source >> 16); } -std::string to_string(const YAML::Node &node) -{ - std::stringstream ss; - ss << node; - return ss.str(); -} - int to_int(std::string &s, int def_vaule) { int retval = 0; diff --git a/misc.h b/misc.h index 9bb80b4..0c5d6f5 100644 --- a/misc.h +++ b/misc.h @@ -51,7 +51,6 @@ void urlParse(std::string url, std::string &host, std::string &path, int &port, void removeUTF8BOM(std::string &data); int shortAssemble(unsigned short num_a, unsigned short num_b); void shortDisassemble(int source, unsigned short &num_a, unsigned short &num_b); -std::string to_string(const YAML::Node &node); int to_int(std::string &s, int def_vaule = 0); std::string fileGet(std::string path, bool binary = true); diff --git a/subexport.cpp b/subexport.cpp index 2f658c7..3d42421 100644 --- a/subexport.cpp +++ b/subexport.cpp @@ -585,7 +585,7 @@ std::string netchToClash(std::vector &nodes, std::string &base_conf, s rulesetToClash(yamlnode, ruleset_content_array); - return to_string(yamlnode); + return YAML::Dump(yamlnode); } std::string netchToSurge(std::vector &nodes, std::string &base_conf, std::vector &ruleset_content_array, string_array &extra_proxy_group, int surge_ver, extra_settings &ext) diff --git a/webserver_libevent.cpp b/webserver_libevent.cpp index 67811ed..64ccca5 100644 --- a/webserver_libevent.cpp +++ b/webserver_libevent.cpp @@ -2,7 +2,9 @@ #include #include #include +#ifdef MALLOC_TRIM #include +#endif // MALLOC_TRIM #include #include