You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2024/03/01 15:25:35 UTC
(trafficserver) 07/17: IPRange.h: resolve compiler error about dangling pointer to temporary (#11090)
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 3b9178b57ab444cfd7f705e890455d21b3eaea94
Author: Brian Olsen <br...@comcast.com>
AuthorDate: Fri Feb 23 11:35:27 2024 -0700
IPRange.h: resolve compiler error about dangling pointer to temporary (#11090)
(cherry picked from commit c7b4151e9616751b67bb9dbc0f4f48bb7285f22e)
---
lib/swoc/include/swoc/IPRange.h | 8 +++++++-
plugins/experimental/txn_box/plugin/src/ip_space.cc | 8 ++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/lib/swoc/include/swoc/IPRange.h b/lib/swoc/include/swoc/IPRange.h
index 547afdb694..b09b879fc2 100644
--- a/lib/swoc/include/swoc/IPRange.h
+++ b/lib/swoc/include/swoc/IPRange.h
@@ -1985,7 +1985,13 @@ IPRangeView::clear() -> self_type & {
inline bool
IPRangeView::empty() const {
- return AF_INET6 == _family ? _raw._6->empty() : AF_INET == _family ? _raw._4->empty() : true;
+ if (AF_INET6 == _family) {
+ return _raw._6->empty();
+ } else if (AF_INET == _family) {
+ return _raw._4->empty();
+ } else {
+ return true;
+ }
}
inline bool
diff --git a/plugins/experimental/txn_box/plugin/src/ip_space.cc b/plugins/experimental/txn_box/plugin/src/ip_space.cc
index 047ed602bd..429db791f7 100644
--- a/plugins/experimental/txn_box/plugin/src/ip_space.cc
+++ b/plugins/experimental/txn_box/plugin/src/ip_space.cc
@@ -907,10 +907,10 @@ Mod_ip_space::operator()(Context &ctx, feature_type_for<IP_ADDR> addr)
}
Feature value{FeatureView::Literal("")};
if (active._space) {
- auto &&[range, payload] = *active._space->space.find(addr);
- active._row = range.empty() ? nullptr : &payload;
- active._addr = addr;
- active._drtv = drtv;
+ auto [range, payload] = *active._space->space.find(addr);
+ active._row = range.empty() ? nullptr : &payload;
+ active._addr = addr;
+ active._drtv = drtv;
// Current active data.
auto *store = Txb_IP_Space::ctx_active_info(ctx);