From 9ea1dcee59986d7804b22aadd17b05453732d647 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Fri, 19 Jul 2019 16:37:24 +0200 Subject: [PATCH] mkcurl.hpp: inline namespace for public symbols This allows us to have more than one version of mkcurl inside of android-libs and/or mkall-ios for testing pursposes. Currently mkcurl is part of MK, so testing is much slower then that as we need to vendor mkcurl into MK, do a full build of MK, and the use that with the apps. With this change, we can be quicker because we can vendor the new version of mkcurl and test it out directly. If that's OK then we can go for vendoring into MK and doing a full build. Xref: https://github.com/measurement-kit/measurement-kit/issues/1867 See also: https://github.com/measurement-kit/mkcollector/pull/25#discussion_r305323787 --- mkcurl.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mkcurl.hpp b/mkcurl.hpp index a3378fc..920e2c0 100644 --- a/mkcurl.hpp +++ b/mkcurl.hpp @@ -10,8 +10,15 @@ #include #include +/// MKCURL_INLINE_NAMESPACE controls the inline inner namespace in which +/// public symbols exported by this library are enclosed. +/// +/// See . +#define MKCURL_INLINE_NAMESPACE v0_11_2_or_greater + namespace mk { namespace curl { +inline namespace MKCURL_INLINE_NAMESPACE { /// Request is an HTTP request. struct Request { @@ -154,6 +161,7 @@ class Client { /// perform performs @p request and returns the Response. Response perform(const Request &request) noexcept; +} // inline namespace MKCURL_INLINE_NAMESPACE } // namespace curl } // namespace mk @@ -188,6 +196,7 @@ Response perform(const Request &request) noexcept; namespace mk { namespace curl { +inline namespace MKCURL_INLINE_NAMESPACE { // mkcurl_log appends @p line to @p logs. It adds information on the current // time in millisecond. It also appends a newline to the end of the line. @@ -239,6 +248,7 @@ struct mkcurl_slist { curl_slist *p = nullptr; }; +} // inline namespace MKCURL_INLINE_NAMESPACE } // namespace curl } // namespace mk @@ -374,6 +384,7 @@ static int mkcurl_debug_cb_(CURL *handle, namespace mk { namespace curl { +inline namespace MKCURL_INLINE_NAMESPACE { // HTTPVersionString returns a string representation of the cURL HTTP // version string in @p httpv. If @p httpv has an unknown value, the @@ -757,6 +768,7 @@ Response perform(const Request &req) noexcept { return Client{}.perform(req); } +} // inline namespace MKCURL_INLINE_NAMESPACE } // namespace curl } // namespace mk #endif // MKCURL_INLINE_IMPL