about summary refs log tree commit diff
path: root/absl/strings
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-10-22T16·35-0700
committerDerek Mauro <dmauro@google.com>2019-10-22T17·33-0400
commit19b021cb3ff23048dfbe236a4e611925d8930831 (patch)
treed5f27e6624024043b2d19f2df199e5472e4b92d7 /absl/strings
parentecc0033b54847f6c9ee37dbb0be8aa17e5b6d37b (diff)
Export of internal Abseil changes
--
3f913305d6582ac0c66c25f71275d89232dc97bf by CJ Johnson <johnsoncj@google.com>:

Internal change

PiperOrigin-RevId: 276081163

--
19c65f15e8b67e4677ebed9f815f934091368f41 by CJ Johnson <johnsoncj@google.com>:

Internal change

PiperOrigin-RevId: 275964906

--
a40557fe4575a6bc9bed4fd83ed8c748bc3f15ff by Derek Mauro <dmauro@google.com>:

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 <johnsoncj@google.com>:

Test FixedArray exception safety for OOM using ThrowingAllocator

PiperOrigin-RevId: 275921366

--
13211ea447af1daf1701ccb1c7c6b2cbaa68eb93 by CJ Johnson <johnsoncj@google.com>:

Internal change

PiperOrigin-RevId: 275913105

--
09dccef0c829cfab5847137ead6866c511e9ce51 by CJ Johnson <johnsoncj@google.com>:

Internal change

PiperOrigin-RevId: 275912911

--
65db8fc06f50e0989aee2d264f8f7a348ff95c17 by Samuel Benzaquen <sbenza@google.com>:

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
Diffstat (limited to 'absl/strings')
-rw-r--r--absl/strings/internal/str_format/bind.cc9
-rw-r--r--absl/strings/internal/str_format/bind.h8
2 files changed, 11 insertions, 6 deletions
diff --git a/absl/strings/internal/str_format/bind.cc b/absl/strings/internal/str_format/bind.cc
index a31859ece2bc..45e335a30948 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<const FormatArgImpl> 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<const FormatArgImpl> args) {
   FILERawSink sink(output);
diff --git a/absl/strings/internal/str_format/bind.h b/absl/strings/internal/str_format/bind.h
index 7df140a43633..7f46035113bb 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<const FormatArgImpl> args);
 
-inline std::string FormatPack(const UntypedFormatSpecImpl format,
-                              absl::Span<const FormatArgImpl> args) {
-  std::string out;
-  AppendPack(&out, format, args);
-  return out;
-}
+std::string FormatPack(const UntypedFormatSpecImpl format,
+                       absl::Span<const FormatArgImpl> args);
 
 int FprintF(std::FILE* output, UntypedFormatSpecImpl format,
             absl::Span<const FormatArgImpl> args);