Skip to content

Commit

Permalink
update abseil-cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
falconindy committed Aug 22, 2024
1 parent 7c814e3 commit b92b32d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
23 changes: 9 additions & 14 deletions src/aur/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include <vector>

#include "absl/container/flat_hash_set.h"
#include "absl/functional/overload.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/strip.h"

namespace fs = std::filesystem;
Expand Down Expand Up @@ -299,20 +301,13 @@ ClientImpl::~ClientImpl() {
}

void ClientImpl::Cancel(const ActiveRequests::value_type& request) {
struct Visitor {
constexpr explicit Visitor(ClientImpl* aur) : aur(aur) {}

void operator()(CURL* curl) {
aur->FinishRequest(curl, CURLE_ABORTED_BY_CALLBACK,
/*dispatch_callback=*/false);
}

void operator()(sd_event_source* source) { aur->FinishRequest(source); }

ClientImpl* aur;
};

std::visit(Visitor(this), request);
std::visit(absl::Overload{
[this](CURL* curl) {
FinishRequest(curl, CURLE_ABORTED_BY_CALLBACK,
/*dispatch_callback=*/false);
},
[this](sd_event_source* source) { FinishRequest(source); }},
request);
}

int ClientImpl::OnCancel(sd_event_source*, void* userdata) {
Expand Down
7 changes: 4 additions & 3 deletions src/aur/package.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
#include "aur/package.hh"

#include "absl/base/no_destructor.h"
#include "aur/json_internal.hh"

namespace aur {
Expand Down Expand Up @@ -47,7 +48,7 @@ void from_json(const nlohmann::json& j, absl::Time& t) {

void from_json(const nlohmann::json& j, Package& p) {
// clang-format off
static const auto& callbacks = *new CallbackMap<Package>{
static const absl::NoDestructor<CallbackMap<Package>> kCallbacks({
{ "CheckDepends", MakeValueCallback(&Package::checkdepends) },
{ "CoMaintainers", MakeValueCallback(&Package::comaintainers) },
{ "Conflicts", MakeValueCallback(&Package::conflicts) },
Expand All @@ -73,10 +74,10 @@ void from_json(const nlohmann::json& j, Package& p) {
{ "URL", MakeValueCallback(&Package::upstream_url) },
{ "URLPath", MakeValueCallback(&Package::aur_urlpath) },
{ "Version", MakeValueCallback(&Package::version) },
};
});
// clang-format on

DeserializeJsonObject(j, callbacks, p);
DeserializeJsonObject(j, *kCallbacks, p);
}

} // namespace aur
7 changes: 4 additions & 3 deletions src/aur/response.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// SPDX-License-Identifier: MIT
#include "aur/response.hh"

#include "absl/base/no_destructor.h"
#include "aur/json_internal.hh"

namespace aur::internal {

void from_json(const nlohmann::json& j, RawRpcResponse& r) {
// clang-format off
static const auto& callbacks = *new CallbackMap<RawRpcResponse>{
static const absl::NoDestructor<CallbackMap<RawRpcResponse>> kCallbacks({
{ "error", MakeValueCallback(&RawRpcResponse::error) },
{ "results", MakeValueCallback(&RawRpcResponse::results) },
};
});
// clang-format on

DeserializeJsonObject(j, callbacks, r);
DeserializeJsonObject(j, *kCallbacks, r);
}

RawRpcResponse::RawRpcResponse(const std::string& json_bytes) {
Expand Down
18 changes: 9 additions & 9 deletions subprojects/abseil-cpp.wrap
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[wrap-file]
directory = abseil-cpp-20230802.1
source_url = https://github.com/abseil/abseil-cpp/archive/20230802.1.tar.gz
source_filename = abseil-cpp-20230802.1.tar.gz
source_hash = 987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed
patch_filename = abseil-cpp_20230802.1-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20230802.1-2/get_patch
patch_hash = f6ceb55ca4b0995d826cbdefc0a37e0f8b6202d3e7ecb3436298f54d3a23942b
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/abseil-cpp_20230802.1-2/abseil-cpp-20230802.1.tar.gz
wrapdb_version = 20230802.1-2
directory = abseil-cpp-20240722.0
source_url = https://github.com/abseil/abseil-cpp/releases/download/20240722.0/abseil-cpp-20240722.0.tar.gz
source_filename = abseil-cpp-20240722.0.tar.gz
source_hash = f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3
patch_filename = abseil-cpp_20240722.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20240722.0-1/get_patch
patch_hash = 692bbbc39cacaba4dc4b0c8b2fbbe32736c9cde6377acfa0d52088797af14ded
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/abseil-cpp_20240722.0-1/abseil-cpp-20240722.0.tar.gz
wrapdb_version = 20240722.0-1

[provide]
absl_base = absl_base_dep
Expand Down

0 comments on commit b92b32d

Please sign in to comment.