summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--icespider/compile/main.cpp28
-rw-r--r--icespider/compile/routeCompiler.cpp24
-rw-r--r--icespider/core/core.cpp12
-rw-r--r--icespider/xslt/exslt-init.cpp34
-rw-r--r--icespider/xslt/xsltStreamSerializer.cpp24
5 files changed, 66 insertions, 56 deletions
diff --git a/icespider/compile/main.cpp b/icespider/compile/main.cpp
index 3133006..fa679f9 100644
--- a/icespider/compile/main.cpp
+++ b/icespider/compile/main.cpp
@@ -17,22 +17,24 @@
namespace po = boost::program_options;
using namespace AdHoc::literals;
-static std::string
-defaultPostProcessor()
-{
- constexpr std::array<const std::pair<std::string_view, std::string_view>, 1> pps {{
- {"clang-format", "-i"},
- }};
- const std::string_view path {getenv("PATH") ?: "/usr/bin"};
- const auto pathBegin = make_split_iterator(path, first_finder(":", boost::is_equal()));
- for (const auto & [cmd, opts] : pps) {
- for (auto p = pathBegin; p != decltype(pathBegin) {}; ++p) {
- if (std::filesystem::exists(std::filesystem::path(p->begin(), p->end()) / cmd)) {
- return "%? %?"_fmt(cmd, opts);
+namespace {
+ std::string
+ defaultPostProcessor()
+ {
+ constexpr std::array<const std::pair<std::string_view, std::string_view>, 1> pps {{
+ {"clang-format", "-i"},
+ }};
+ const std::string_view path {getenv("PATH") ?: "/usr/bin"};
+ const auto pathBegin = make_split_iterator(path, first_finder(":", boost::is_equal()));
+ for (const auto & [cmd, opts] : pps) {
+ for (auto p = pathBegin; p != decltype(pathBegin) {}; ++p) {
+ if (std::filesystem::exists(std::filesystem::path(p->begin(), p->end()) / cmd)) {
+ return "%? %?"_fmt(cmd, opts);
+ }
}
}
+ return {};
}
- return "";
}
int
diff --git a/icespider/compile/routeCompiler.cpp b/icespider/compile/routeCompiler.cpp
index a7a7695..4057158 100644
--- a/icespider/compile/routeCompiler.cpp
+++ b/icespider/compile/routeCompiler.cpp
@@ -272,19 +272,21 @@ namespace IceSpider::Compile {
return Slicer::ModelPartForEnum<Enum>::lookup(e);
}
- static std::string
- outputSerializerClass(const IceSpider::OutputSerializers::value_type & os)
- {
- return boost::algorithm::replace_all_copy(os.second->serializer, ".", "::");
- }
+ namespace {
+ std::string
+ outputSerializerClass(const IceSpider::OutputSerializers::value_type & os)
+ {
+ return boost::algorithm::replace_all_copy(os.second->serializer, ".", "::");
+ }
- AdHocFormatter(MimePair, R"C({ "%?", "%?" })C");
+ AdHocFormatter(MimePair, R"C({ "%?", "%?" })C");
- static std::string
- outputSerializerMime(const IceSpider::OutputSerializers::value_type & os)
- {
- auto slash = os.first.find('/');
- return MimePair::get(os.first.substr(0, slash), os.first.substr(slash + 1));
+ std::string
+ outputSerializerMime(const IceSpider::OutputSerializers::value_type & os)
+ {
+ auto slash = os.first.find('/');
+ return MimePair::get(os.first.substr(0, slash), os.first.substr(slash + 1));
+ }
}
void
diff --git a/icespider/core/core.cpp b/icespider/core/core.cpp
index 7aa1317..6aacb15 100644
--- a/icespider/core/core.cpp
+++ b/icespider/core/core.cpp
@@ -118,11 +118,13 @@ namespace IceSpider {
defaultErrorReport(request, exception);
}
- auto
- demangle(const char * const name)
- {
- return std::unique_ptr<char, decltype(&std::free)>(
- __cxxabiv1::__cxa_demangle(name, nullptr, nullptr, nullptr), std::free);
+ namespace {
+ auto
+ demangle(const char * const name)
+ {
+ return std::unique_ptr<char, decltype(&std::free)>(
+ __cxxabiv1::__cxa_demangle(name, nullptr, nullptr, nullptr), std::free);
+ }
}
AdHocFormatter(LogExp, "Exception type: %?\nDetail: %?\n");
diff --git a/icespider/xslt/exslt-init.cpp b/icespider/xslt/exslt-init.cpp
index 110a999..55b2407 100644
--- a/icespider/xslt/exslt-init.cpp
+++ b/icespider/xslt/exslt-init.cpp
@@ -2,23 +2,25 @@
#include <libxml/parser.h>
#include <libxslt/xslt.h>
-static void initLibXml() __attribute__((constructor(102)));
+namespace {
+ void initLibXml() __attribute__((constructor(102)));
-void
-initLibXml()
-{
- xmlInitParser();
- exsltRegisterAll();
-}
+ void
+ initLibXml()
+ {
+ xmlInitParser();
+ exsltRegisterAll();
+ }
-// LCOV_EXCL_START lcov actually misses destructor functions
-static void cleanupLibXml() __attribute__((destructor(102)));
+ // LCOV_EXCL_START lcov actually misses destructor functions
+ static void cleanupLibXml() __attribute__((destructor(102)));
-void
-cleanupLibXml()
-{
- xsltCleanupGlobals();
- xmlCleanupParser();
-}
+ void
+ cleanupLibXml()
+ {
+ xsltCleanupGlobals();
+ xmlCleanupParser();
+ }
-// LCOV_EXCL_STOP
+ // LCOV_EXCL_STOP
+}
diff --git a/icespider/xslt/xsltStreamSerializer.cpp b/icespider/xslt/xsltStreamSerializer.cpp
index 6fb265c..6fbe8ed 100644
--- a/icespider/xslt/xsltStreamSerializer.cpp
+++ b/icespider/xslt/xsltStreamSerializer.cpp
@@ -16,18 +16,20 @@
#include <slicer/xml/serializer.h>
namespace IceSpider {
- static int
- xmlstrmclosecallback(void * context)
- {
- static_cast<std::ostream *>(context)->flush();
- return 0;
- }
+ namespace {
+ int
+ xmlstrmclosecallback(void * context)
+ {
+ static_cast<std::ostream *>(context)->flush();
+ return 0;
+ }
- static int
- xmlstrmwritecallback(void * context, const char * buffer, int len)
- {
- static_cast<std::ostream *>(context)->write(buffer, len);
- return len;
+ int
+ xmlstrmwritecallback(void * context, const char * buffer, int len)
+ {
+ static_cast<std::ostream *>(context)->write(buffer, len);
+ return len;
+ }
}
XsltStreamSerializer::IceSpiderFactory::IceSpiderFactory(const char * path) :