Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
mkcurl.hpp: inline namespace for public symbols
Browse files Browse the repository at this point in the history
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: measurement-kit/measurement-kit#1867

See also: measurement-kit/mkcollector#25 (comment)
  • Loading branch information
bassosimone committed Jul 24, 2019
1 parent ccc2826 commit 9ea1dce
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mkcurl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@
#include <string>
#include <vector>

/// MKCURL_INLINE_NAMESPACE controls the inline inner namespace in which
/// public symbols exported by this library are enclosed.
///
/// See <https://github.com/measurement-kit/measurement-kit/issues/1867#issuecomment-514562622>.
#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 {
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -239,6 +248,7 @@ struct mkcurl_slist {
curl_slist *p = nullptr;
};

} // inline namespace MKCURL_INLINE_NAMESPACE
} // namespace curl
} // namespace mk

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9ea1dce

Please sign in to comment.