diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2018-12-13 10:19:17 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2018-12-13 10:19:17 -0800 |
commit | 101aeba0fb7522880e2164c733c0218293384f50 (patch) | |
tree | d0e68b344f92b6ccd078e986af746ac03bd3f76d /upb/msg.h | |
parent | cf0a89ed69561d73210056566272b27844a95782 (diff) | |
parent | 10e682cf2a0e8dcfd79f9dfbad5367f6b6bf8a61 (diff) |
Merge branch 'arrayapi' into defcleanup
Diffstat (limited to 'upb/msg.h')
-rw-r--r-- | upb/msg.h | 25 |
1 files changed, 0 insertions, 25 deletions
@@ -218,31 +218,6 @@ bool upb_msg_clearfield(upb_msg *msg, * semantics are the same as upb_msg. A upb_array allocates dynamic * memory internally for the array elements. */ -UPB_INLINE const void *_upb_array_accessor(const upb_array *arr, size_t *size) { - if (size) *size = arr->size; - return arr->data; -} - -UPB_INLINE void *_upb_array_mutable_accessor(upb_array *arr, size_t *size) { - if (size) *size = arr->size; - return arr->data; -} - -UPB_INLINE void *_upb_array_resize_accessor(upb_array *arr, size_t size, - size_t elem_size) { - if (size > arr->size) { - size_t new_size = UPB_MAX(arr->size, 4); - size_t old_bytes = arr->size * elem_size; - size_t new_bytes; - upb_alloc *alloc = upb_arena_alloc(arr->arena); - while (new_size < size) new_size *= 2; - new_bytes = new_size * elem_size; - arr->data = upb_realloc(alloc, arr->data, old_bytes, new_bytes); - } - arr->len = size; - return arr->data; -} - upb_array *upb_array_new(upb_fieldtype_t type, upb_arena *a); upb_fieldtype_t upb_array_type(const upb_array *arr); |