upb: remove port_def references from upb/protos/

PiperOrigin-RevId: 585705761
pull/14835/head
Eric Salo 2023-11-27 11:14:23 -08:00 committed by Copybara-Service
parent 967a351e26
commit 7c5e18b838
3 changed files with 4 additions and 13 deletions

View File

@ -36,7 +36,6 @@ cc_library(
"//upb:message",
"//upb:message_copy",
"//upb:message_types",
"//upb:port",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/strings",
],

View File

@ -8,6 +8,8 @@
#ifndef UPB_PROTOS_REPEATED_FIELD_H_
#define UPB_PROTOS_REPEATED_FIELD_H_
#include <assert.h>
#include <cstddef>
#include <iterator>
#include <type_traits>
@ -22,11 +24,7 @@
#include "upb/message/copy.h"
#include "upb/message/types.h"
// Must be last:
#include "upb/port/def.inc"
namespace protos {
namespace internal {
// Shared implementation of repeated fields for absl::string_view and
@ -185,9 +183,9 @@ class RepeatedFieldStringProxy
void push_back(T t) {
upb_MessageValue message_value;
// Copy string to arena.
UPB_ASSERT(this->arena_);
assert(this->arena_);
char* data = (char*)upb_Arena_Malloc(this->arena_, t.size());
UPB_ASSERT(data);
assert(data);
memcpy(data, t.data(), t.size());
message_value.str_val = upb_StringView_FromDataAndSize(data, t.size());
upb_Array_Append(this->arr_, message_value, this->arena_);
@ -297,6 +295,4 @@ class RepeatedField {
} // namespace protos
#include "upb/port/undef.inc"
#endif // UPB_PROTOS_REPEATED_FIELD_H_

View File

@ -18,11 +18,7 @@
#include "upb/base/string_view.h"
#include "upb/mem/arena.h"
#include "upb/message/array.h"
#include "upb/message/copy.h"
// Must be last:
#include "upb/message/types.h"
#include "upb/port/def.inc"
namespace protos {
namespace internal {