code size optimization, moved function definition to the source file
PiperOrigin-RevId: 490775181
diff --git a/src/google/protobuf/io/coded_stream.cc b/src/google/protobuf/io/coded_stream.cc
index 8f08e7b..0ebc0f2 100644
--- a/src/google/protobuf/io/coded_stream.cc
+++ b/src/google/protobuf/io/coded_stream.cc
@@ -722,6 +722,13 @@
// CodedOutputStream =================================================
+uint8_t* EpsCopyOutputStream::EnsureSpace(uint8_t* ptr) {
+ if (PROTOBUF_PREDICT_FALSE(ptr >= end_)) {
+ return EnsureSpaceFallback(ptr);
+ }
+ return ptr;
+}
+
void EpsCopyOutputStream::EnableAliasing(bool enabled) {
aliasing_enabled_ = enabled && stream_->AllowsAliasing();
}
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
index 0615941..57a171e 100644
--- a/src/google/protobuf/io/coded_stream.h
+++ b/src/google/protobuf/io/coded_stream.h
@@ -674,12 +674,7 @@
// After this it's guaranteed you can safely write kSlopBytes to ptr. This
// will never fail! The underlying stream can produce an error. Use HadError
// to check for errors.
- PROTOBUF_NODISCARD uint8_t* EnsureSpace(uint8_t* ptr) {
- if (PROTOBUF_PREDICT_FALSE(ptr >= end_)) {
- return EnsureSpaceFallback(ptr);
- }
- return ptr;
- }
+ PROTOBUF_NODISCARD PROTOBUF_NOINLINE uint8_t* EnsureSpace(uint8_t* ptr);
uint8_t* WriteRaw(const void* data, int size, uint8_t* ptr) {
if (PROTOBUF_PREDICT_FALSE(end_ - ptr < size)) {