From 9b716e3b782b0acba5cda2aacdb060c373536184 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 6 Nov 2024 16:02:09 -0800 Subject: [PATCH] Internal change PiperOrigin-RevId: 693895069 --- upb/mem/arena.c | 5 +++++ upb/mem/arena.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/upb/mem/arena.c b/upb/mem/arena.c index 975520b7c758..e313d605be1a 100644 --- a/upb/mem/arena.c +++ b/upb/mem/arena.c @@ -565,6 +565,11 @@ void upb_Arena_DecRefFor(const upb_Arena* a, const void* owner) { upb_Arena_Free((upb_Arena*)a); } +upb_alloc* upb_Arena_GetUpbAlloc(upb_Arena* a) { + upb_ArenaInternal* ai = upb_Arena_Internal(a); + return _upb_ArenaInternal_BlockAlloc(ai); +} + void UPB_PRIVATE(_upb_Arena_SwapIn)(upb_Arena* des, const upb_Arena* src) { upb_ArenaInternal* desi = upb_Arena_Internal(des); upb_ArenaInternal* srci = upb_Arena_Internal(src); diff --git a/upb/mem/arena.h b/upb/mem/arena.h index 63fad6d3ff98..f0d9d2d6f0e2 100644 --- a/upb/mem/arena.h +++ b/upb/mem/arena.h @@ -44,6 +44,9 @@ UPB_API void upb_Arena_Free(upb_Arena* a); UPB_API bool upb_Arena_Fuse(const upb_Arena* a, const upb_Arena* b); UPB_API bool upb_Arena_IsFused(const upb_Arena* a, const upb_Arena* b); +// Returns the upb_alloc used by the arena. +UPB_API upb_alloc* upb_Arena_GetUpbAlloc(upb_Arena* a); + bool upb_Arena_IncRefFor(const upb_Arena* a, const void* owner); void upb_Arena_DecRefFor(const upb_Arena* a, const void* owner);