upb: tag _upb_Message_Getext() as UPB_PRIVATE()

PiperOrigin-RevId: 600639423
pull/15492/head
Eric Salo 1 year ago committed by Copybara-Service
parent 303239d74d
commit 373ffa6622
  1. 1
      protos/BUILD
  2. 7
      protos/protos.cc
  3. 7
      upb/message/internal/accessors.h
  4. 4
      upb/message/internal/extension.c
  5. 2
      upb/message/internal/extension.h
  6. 2
      upb/message/promote.c

@ -58,6 +58,7 @@ cc_library(
"//upb:message_copy",
"//upb:message_promote",
"//upb:mini_table",
"//upb:port",
"//upb:wire",
"//upb:wire_reader",
"//upb/message:internal",

@ -26,6 +26,9 @@
#include "upb/wire/decode.h"
#include "upb/wire/encode.h"
// Must be last.
#include "upb/port/def.inc"
namespace protos {
// begin:google_only
@ -114,7 +117,7 @@ class MessageLock {
bool HasExtensionOrUnknown(const upb_Message* msg,
const upb_MiniTableExtension* eid) {
MessageLock msg_lock(msg);
return _upb_Message_Getext(msg, eid) != nullptr ||
return UPB_PRIVATE(_upb_Message_Getext)(msg, eid) != nullptr ||
upb_Message_FindUnknown(msg, upb_MiniTableExtension_Number(eid), 0)
.status == kUpb_FindUnknown_Ok;
}
@ -123,7 +126,7 @@ const upb_Extension* GetOrPromoteExtension(upb_Message* msg,
const upb_MiniTableExtension* eid,
upb_Arena* arena) {
MessageLock msg_lock(msg);
const upb_Extension* ext = _upb_Message_Getext(msg, eid);
const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getext)(msg, eid);
if (ext == nullptr) {
upb_GetExtension_Status ext_status = upb_MiniTable_GetOrPromoteExtension(
(upb_Message*)msg, eid, 0, arena, &ext);

@ -240,7 +240,7 @@ UPB_INLINE bool UPB_PRIVATE(_upb_Message_HasBaseField)(
UPB_INLINE bool UPB_PRIVATE(_upb_Message_HasExtension)(
const struct upb_Message* msg, const upb_MiniTableExtension* ext) {
UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->UPB_PRIVATE(field)));
return _upb_Message_Getext(msg, ext) != NULL;
return UPB_PRIVATE(_upb_Message_Getext)(msg, ext) != NULL;
}
static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
@ -260,7 +260,8 @@ static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
UPB_INLINE void _upb_Message_GetExtensionField(
const struct upb_Message* msg, const upb_MiniTableExtension* mt_ext,
const void* default_val, void* val) {
const struct upb_Extension* ext = _upb_Message_Getext(msg, mt_ext);
const struct upb_Extension* ext =
UPB_PRIVATE(_upb_Message_Getext)(msg, mt_ext);
const upb_MiniTableField* f = &mt_ext->UPB_PRIVATE(field);
UPB_ASSUME(upb_MiniTableField_IsExtension(f));
@ -316,7 +317,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_Message_ClearExtension)(
const struct upb_Extension* base =
UPB_PTR_AT(in, in->ext_begin, struct upb_Extension);
struct upb_Extension* ext =
(struct upb_Extension*)_upb_Message_Getext(msg, e);
(struct upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
if (ext) {
*ext = *base;
in->ext_begin += sizeof(struct upb_Extension);

@ -18,7 +18,7 @@
// Must be last.
#include "upb/port/def.inc"
const struct upb_Extension* _upb_Message_Getext(
const struct upb_Extension* UPB_PRIVATE(_upb_Message_Getext)(
const struct upb_Message* msg, const upb_MiniTableExtension* e) {
size_t n;
const struct upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &n);
@ -50,7 +50,7 @@ const struct upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)(
struct upb_Extension* _upb_Message_GetOrCreateExtension(
struct upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* a) {
struct upb_Extension* ext =
(struct upb_Extension*)_upb_Message_Getext(msg, e);
(struct upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
if (ext) return ext;
if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, sizeof(struct upb_Extension), a))
return NULL;

@ -51,7 +51,7 @@ const struct upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)(
// Returns an extension for a message with a given mini table,
// or NULL if no extension exists with this mini table.
const struct upb_Extension* _upb_Message_Getext(
const struct upb_Extension* UPB_PRIVATE(_upb_Message_Getext)(
const struct upb_Message* msg, const upb_MiniTableExtension* ext);
#ifdef __cplusplus

@ -68,7 +68,7 @@ upb_GetExtension_Status upb_MiniTable_GetOrPromoteExtension(
upb_Message* msg, const upb_MiniTableExtension* ext_table,
int decode_options, upb_Arena* arena, const upb_Extension** extension) {
UPB_ASSERT(upb_MiniTableExtension_CType(ext_table) == kUpb_CType_Message);
*extension = _upb_Message_Getext(msg, ext_table);
*extension = UPB_PRIVATE(_upb_Message_Getext)(msg, ext_table);
if (*extension) {
return kUpb_GetExtension_Ok;
}

Loading…
Cancel
Save