From 19b021cb3ff23048dfbe236a4e611925d8930831 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 22 Oct 2019 09:35:23 -0700 Subject: Export of internal Abseil changes -- 3f913305d6582ac0c66c25f71275d89232dc97bf by CJ Johnson : Internal change PiperOrigin-RevId: 276081163 -- 19c65f15e8b67e4677ebed9f815f934091368f41 by CJ Johnson : Internal change PiperOrigin-RevId: 275964906 -- a40557fe4575a6bc9bed4fd83ed8c748bc3f15ff by Derek Mauro : Always enable symbolization on Windows. This doesn't require debug builds, only PDB files. https://github.com/abseil/abseil-cpp/pull/257 PiperOrigin-RevId: 275961084 -- 953bec0e67d2495e901b940b67b6330291871998 by CJ Johnson : Test FixedArray exception safety for OOM using ThrowingAllocator PiperOrigin-RevId: 275921366 -- 13211ea447af1daf1701ccb1c7c6b2cbaa68eb93 by CJ Johnson : Internal change PiperOrigin-RevId: 275913105 -- 09dccef0c829cfab5847137ead6866c511e9ce51 by CJ Johnson : Internal change PiperOrigin-RevId: 275912911 -- 65db8fc06f50e0989aee2d264f8f7a348ff95c17 by Samuel Benzaquen : Move FormatPack to bind.cc. We do not get any benefit from inlining this function, but it creates unnecessary bloat at the call site. Moving it to the .cc file moves the initialization of the string out of the caller code. PiperOrigin-RevId: 275889073 GitOrigin-RevId: 3f913305d6582ac0c66c25f71275d89232dc97bf Change-Id: Ia471eebba7322a6ea4edc954e50b30a060a45e39 --- absl/strings/internal/str_format/bind.cc | 9 +++++++++ absl/strings/internal/str_format/bind.h | 8 ++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'absl/strings') diff --git a/absl/strings/internal/str_format/bind.cc b/absl/strings/internal/str_format/bind.cc index a31859ec..45e335a3 100644 --- a/absl/strings/internal/str_format/bind.cc +++ b/absl/strings/internal/str_format/bind.cc @@ -196,6 +196,15 @@ std::string& AppendPack(std::string* out, const UntypedFormatSpecImpl format, return *out; } +std::string FormatPack(const UntypedFormatSpecImpl format, + absl::Span args) { + std::string out; + if (ABSL_PREDICT_FALSE(!FormatUntyped(&out, format, args))) { + out.clear(); + } + return out; +} + int FprintF(std::FILE* output, const UntypedFormatSpecImpl format, absl::Span args) { FILERawSink sink(output); diff --git a/absl/strings/internal/str_format/bind.h b/absl/strings/internal/str_format/bind.h index 7df140a4..7f460351 100644 --- a/absl/strings/internal/str_format/bind.h +++ b/absl/strings/internal/str_format/bind.h @@ -178,12 +178,8 @@ bool FormatUntyped(FormatRawSinkImpl raw_sink, std::string& AppendPack(std::string* out, UntypedFormatSpecImpl format, absl::Span args); -inline std::string FormatPack(const UntypedFormatSpecImpl format, - absl::Span args) { - std::string out; - AppendPack(&out, format, args); - return out; -} +std::string FormatPack(const UntypedFormatSpecImpl format, + absl::Span args); int FprintF(std::FILE* output, UntypedFormatSpecImpl format, absl::Span args); -- cgit v1.2.3