From b19ec98accca194511616f789c0a448c2b9d40e7 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Tue, 9 May 2023 06:50:05 -0700 Subject: Stop moving an absl::FunctionRef, since the class isn't movable, it will just be a copy anyway. Also remove the typedef so that it is clear from the type at the callsite that moving it isn't necessary. Fixes #1443 PiperOrigin-RevId: 530596294 Change-Id: I58ffc370bbccc0816bca4c4f85c3bb12c7ee2eb2 --- absl/strings/internal/cord_rep_consume.cc | 8 +++++--- absl/strings/internal/cord_rep_consume.h | 11 ++++------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'absl/strings') diff --git a/absl/strings/internal/cord_rep_consume.cc b/absl/strings/internal/cord_rep_consume.cc index 20a55797..db7d4fef 100644 --- a/absl/strings/internal/cord_rep_consume.cc +++ b/absl/strings/internal/cord_rep_consume.cc @@ -42,7 +42,8 @@ CordRep* ClipSubstring(CordRepSubstring* substring) { } // namespace -void Consume(CordRep* rep, ConsumeFn consume_fn) { +void Consume(CordRep* rep, + FunctionRef consume_fn) { size_t offset = 0; size_t length = rep->length; @@ -53,8 +54,9 @@ void Consume(CordRep* rep, ConsumeFn consume_fn) { consume_fn(rep, offset, length); } -void ReverseConsume(CordRep* rep, ConsumeFn consume_fn) { - return Consume(rep, std::move(consume_fn)); +void ReverseConsume(CordRep* rep, + FunctionRef consume_fn) { + return Consume(rep, consume_fn); } } // namespace cord_internal diff --git a/absl/strings/internal/cord_rep_consume.h b/absl/strings/internal/cord_rep_consume.h index d46fca2b..bece1874 100644 --- a/absl/strings/internal/cord_rep_consume.h +++ b/absl/strings/internal/cord_rep_consume.h @@ -24,11 +24,6 @@ namespace absl { ABSL_NAMESPACE_BEGIN namespace cord_internal { -// Functor for the Consume() and ReverseConsume() functions: -// void ConsumeFunc(CordRep* rep, size_t offset, size_t length); -// See the Consume() and ReverseConsume() function comments for documentation. -using ConsumeFn = FunctionRef; - // Consume() and ReverseConsume() consume CONCAT based trees and invoke the // provided functor with the contained nodes in the proper forward or reverse // order, which is used to convert CONCAT trees into other tree or cord data. @@ -40,8 +35,10 @@ using ConsumeFn = FunctionRef; // violations, we can not 100% guarantee that all code respects 'new format' // settings and flags, so we need to be able to parse old data on the fly until // all old code is deprecated / no longer the default format. -void Consume(CordRep* rep, ConsumeFn consume_fn); -void ReverseConsume(CordRep* rep, ConsumeFn consume_fn); +void Consume(CordRep* rep, + FunctionRef consume_fn); +void ReverseConsume(CordRep* rep, + FunctionRef consume_fn); } // namespace cord_internal ABSL_NAMESPACE_END -- cgit v1.2.3