Skip to content

Commit

Permalink
Let ParseRepeatedStringOnce call AllocateFromStringBlock().
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 542617650
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jun 22, 2023
1 parent fd5167d commit bcf3e36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/google/protobuf/generated_message_tctable_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,8 @@ class PROTOBUF_EXPORT TcParser final {
static inline const char* RepeatedString(PROTOBUF_TC_PARAM_DECL);

static inline const char* ParseRepeatedStringOnce(
const char* ptr, Arena* arena, SerialArena* serial_arena,
ParseContext* ctx, RepeatedPtrField<std::string>& field);
const char* ptr, SerialArena* serial_arena, ParseContext* ctx,
RepeatedPtrField<std::string>& field);

static void AddUnknownEnum(MessageLite* msg, const TcParseTableBase* table,
uint32_t tag, int32_t enum_value);
Expand Down
8 changes: 4 additions & 4 deletions src/google/protobuf/generated_message_tctable_lite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedString(
field.PrepareForParse())) {
do {
ptr += sizeof(TagType);
ptr = ParseRepeatedStringOnce(ptr, arena, serial_arena, ctx, field);
ptr = ParseRepeatedStringOnce(ptr, serial_arena, ctx, field);

if (PROTOBUF_PREDICT_FALSE(ptr == nullptr || !validate_last_string())) {
PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS);
Expand Down Expand Up @@ -2273,11 +2273,11 @@ PROTOBUF_NOINLINE const char* TcParser::MpString(PROTOBUF_TC_PARAM_DECL) {
}

PROTOBUF_ALWAYS_INLINE const char* TcParser::ParseRepeatedStringOnce(
const char* ptr, Arena* arena, SerialArena* serial_arena, ParseContext* ctx,
const char* ptr, SerialArena* serial_arena, ParseContext* ctx,
RepeatedPtrField<std::string>& field) {
int size = ReadSize(&ptr);
if (PROTOBUF_PREDICT_FALSE(!ptr)) return {};
auto* str = Arena::Create<std::string>(arena);
auto* str = new (serial_arena->AllocateFromStringBlock()) std::string();
field.AddAllocatedForParse(str);
ptr = ctx->ReadString(ptr, size, str);
if (PROTOBUF_PREDICT_FALSE(!ptr)) return {};
Expand Down Expand Up @@ -2312,7 +2312,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedString(
field.PrepareForParse())) {
do {
ptr = ptr2;
ptr = ParseRepeatedStringOnce(ptr, arena, serial_arena, ctx, field);
ptr = ParseRepeatedStringOnce(ptr, serial_arena, ctx, field);
if (PROTOBUF_PREDICT_FALSE(ptr == nullptr ||
!MpVerifyUtf8(field[field.size() - 1],
table, entry, xform_val))) {
Expand Down

0 comments on commit bcf3e36

Please sign in to comment.