Moved upb_array_new() to upb/reflection.h where it belongs.

pull/13171/head
Joshua Haberman 5 years ago
parent 059f226d41
commit d541566a7b
  1. 2
      upb/decode.c
  2. 4
      upb/msg.c
  3. 2
      upb/msg.h
  4. 4
      upb/reflection.c
  5. 3
      upb/reflection.h

@ -220,7 +220,7 @@ static upb_array *upb_getorcreatearr(upb_decframe *frame,
if (!arr) {
upb_fieldtype_t type = desctype_to_fieldtype[field->descriptortype];
arr = upb_array_new(frame->state->arena, type);
arr = _upb_array_new(frame->state->arena, type);
CHK(arr);
*(upb_array**)&frame->msg[field->offset] = arr;
}

@ -101,7 +101,7 @@ const char *upb_msg_getunknown(const upb_msg *msg, size_t *len) {
/** upb_array *****************************************************************/
upb_array *upb_array_new(upb_arena *a, upb_fieldtype_t type) {
upb_array *_upb_array_new(upb_arena *a, upb_fieldtype_t type) {
upb_array *arr = upb_arena_malloc(a, sizeof(upb_array));
if (!arr) {
@ -141,7 +141,7 @@ void *_upb_array_resize_fallback(upb_array **arr_ptr, size_t size,
upb_fieldtype_t type, upb_arena *arena) {
upb_array *arr = *arr_ptr;
if (!arr) {
arr = upb_array_new(arena, type);
arr = _upb_array_new(arena, type);
if (!arr) return NULL;
*arr_ptr = arr;
}

@ -122,7 +122,7 @@ UPB_INLINE void *_upb_array_ptr(upb_array *arr) {
}
/* Creates a new array on the given arena. */
upb_array *upb_array_new(upb_arena *a, upb_fieldtype_t type);
upb_array *_upb_array_new(upb_arena *a, upb_fieldtype_t type);
/* Resizes the capacity of the array to be at least min_size. */
bool _upb_array_realloc(upb_array *arr, size_t min_size, upb_arena *arena);

@ -161,6 +161,10 @@ void upb_msg_set(upb_msg *msg, const upb_fielddef *f, upb_msgval val,
/** upb_array *****************************************************************/
upb_array *upb_array_new(upb_arena *a, upb_fieldtype_t type) {
return _upb_array_new(a, type);
}
size_t upb_array_size(const upb_array *arr) {
return arr->len;
}

@ -54,6 +54,9 @@ void upb_msg_clearfield(upb_msg *msg, const upb_fielddef *f);
/** upb_array *****************************************************************/
/* Creates a new array on the given arena that holds elements of this type. */
upb_array *upb_array_new(upb_arena *a, upb_fieldtype_t type);
/* Returns the size of the array. */
size_t upb_array_size(const upb_array *arr);

Loading…
Cancel
Save