This is an automated email from the ASF dual-hosted git repository.

bnolsen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new c7b4151e96 IPRange.h: resolve compiler error about dangling pointer to 
temporary (#11090)
c7b4151e96 is described below

commit c7b4151e9616751b67bb9dbc0f4f48bb7285f22e
Author: Brian Olsen <[email protected]>
AuthorDate: Fri Feb 23 11:35:27 2024 -0700

    IPRange.h: resolve compiler error about dangling pointer to temporary 
(#11090)
---
 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);

Reply via email to