Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump RafikFarhad/clang-format-github-action from 3.0.0 to 3.2.0 #981

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Check format
uses: RafikFarhad/[email protected]
uses: RafikFarhad/[email protected]
with:
sources: "include/**/*.hpp,include/**/*.cpp,cpr/**/*.hpp,cpr/**/*.cpp"
style: "file"
2 changes: 1 addition & 1 deletion include/cpr/async_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AsyncWrapper {
// Destructor
~AsyncWrapper() {
if constexpr (isCancellable) {
if(is_cancelled) {
if (is_cancelled) {
is_cancelled->store(true);
}
}
Expand Down
10 changes: 5 additions & 5 deletions include/cpr/redirect.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ class Redirect {

Redirect() = default;
// NOLINTNEXTLINE (google-runtime-int)
Redirect(long p_maximum, bool p_follow, bool p_cont_send_cred, PostRedirectFlags p_post_flags) : maximum(p_maximum), follow(p_follow), cont_send_cred(p_cont_send_cred), post_flags(p_post_flags){}
Redirect(long p_maximum, bool p_follow, bool p_cont_send_cred, PostRedirectFlags p_post_flags) : maximum(p_maximum), follow(p_follow), cont_send_cred(p_cont_send_cred), post_flags(p_post_flags) {}
// NOLINTNEXTLINE (google-runtime-int)
explicit Redirect(long p_maximum) : maximum(p_maximum){}
explicit Redirect(bool p_follow) : follow(p_follow){}
Redirect(bool p_follow, bool p_cont_send_cred) : follow(p_follow), cont_send_cred(p_cont_send_cred){}
explicit Redirect(PostRedirectFlags p_post_flags) : post_flags(p_post_flags){}
explicit Redirect(long p_maximum) : maximum(p_maximum) {}
explicit Redirect(bool p_follow) : follow(p_follow) {}
Redirect(bool p_follow, bool p_cont_send_cred) : follow(p_follow), cont_send_cred(p_cont_send_cred) {}
explicit Redirect(PostRedirectFlags p_post_flags) : post_flags(p_post_flags) {}
};
} // namespace cpr

Expand Down
24 changes: 12 additions & 12 deletions include/cpr/resolve.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#ifndef CPR_RESOLVE_H
#define CPR_RESOLVE_H

#include <string>
#include <set>
#include <string>

namespace cpr {
class Resolve {
public:
std::string host;
std::string addr;
std::set<uint16_t> ports;
class Resolve {
public:
std::string host;
std::string addr;
std::set<uint16_t> ports;

Resolve(const std::string& host_param, const std::string& addr_param, const std::set<uint16_t>& ports_param = std::set<uint16_t>{80U, 443U}): host(host_param), addr(addr_param), ports(ports_param) {
if (this->ports.empty()) {
this->ports.insert(80U);
this->ports.insert(443U);
}
Resolve(const std::string& host_param, const std::string& addr_param, const std::set<uint16_t>& ports_param = std::set<uint16_t>{80U, 443U}) : host(host_param), addr(addr_param), ports(ports_param) {
if (this->ports.empty()) {
this->ports.insert(80U);
this->ports.insert(443U);
}
};
}
};
} // namespace cpr

#endif
55 changes: 28 additions & 27 deletions include/cpr/singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,44 @@
#include <mutex>

#ifndef CPR_DISABLE_COPY
#define CPR_DISABLE_COPY(Class) \
#define CPR_DISABLE_COPY(Class) \
Class(const Class&) = delete; \
Class& operator=(const Class&) = delete;
#endif

#ifndef CPR_SINGLETON_DECL
#define CPR_SINGLETON_DECL(Class) \
public: \
static Class* GetInstance(); \
static void ExitInstance(); \
private: \
CPR_DISABLE_COPY(Class) \
static Class* s_pInstance; \
static std::mutex s_mutex;
public: \
static Class* GetInstance(); \
static void ExitInstance(); \
\
private: \
CPR_DISABLE_COPY(Class) \
static Class* s_pInstance; \
static std::mutex s_mutex;
#endif

#ifndef CPR_SINGLETON_IMPL
#define CPR_SINGLETON_IMPL(Class) \
Class* Class::s_pInstance = nullptr; \
std::mutex Class::s_mutex; \
Class* Class::GetInstance() { \
if (s_pInstance == nullptr) { \
s_mutex.lock(); \
#define CPR_SINGLETON_IMPL(Class) \
Class* Class::s_pInstance = nullptr; \
std::mutex Class::s_mutex; \
Class* Class::GetInstance() { \
if (s_pInstance == nullptr) { \
s_mutex.lock(); \
if (s_pInstance == nullptr) { \
s_pInstance = new Class; \
} \
s_mutex.unlock(); \
} \
return s_pInstance; \
} \
void Class::ExitInstance() { \
s_mutex.lock(); \
if (s_pInstance) { \
delete s_pInstance; \
s_pInstance = nullptr; \
} \
s_mutex.unlock(); \
s_pInstance = new Class; \
} \
s_mutex.unlock(); \
} \
return s_pInstance; \
} \
void Class::ExitInstance() { \
s_mutex.lock(); \
if (s_pInstance) { \
delete s_pInstance; \
s_pInstance = nullptr; \
} \
s_mutex.unlock(); \
}
#endif

Expand Down
Loading