Lines Matching refs:alloc
820 upb_alloc *alloc;
835 char *new_buf = upb_realloc(e->alloc, e->buf, old_size, new_size);
1187 e.alloc = upb_arena_alloc(arena);
1275 upb_alloc *alloc = upb_arena_alloc(arena);
1278 void *mem = upb_realloc(alloc, in->unknown, in->unknown_size, newsize);
1728 upb_value *val, upb_alloc *alloc) {
1732 if (alloc) {
1734 upb_free(alloc, (void*)tabkey);
2316 static void *upb_global_allocfunc(upb_alloc *alloc, void *ptr, size_t oldsize,
2318 UPB_UNUSED(alloc);
2417 static void *upb_arena_doalloc(upb_alloc *alloc, void *ptr, size_t oldsize,
2419 upb_arena *a = (upb_arena*)alloc; /* upb_alloc is initial member. */
2425 upb_arena *arena_initslow(void *mem, size_t n, upb_alloc *alloc) {
2431 if (!alloc || !(mem = upb_malloc(alloc, n))) {
2438 a->head.alloc.func = &upb_arena_doalloc;
2439 a->block_alloc = alloc;
2450 upb_arena *upb_arena_init(void *mem, size_t n, upb_alloc *alloc) {
2458 return arena_initslow(mem, n, alloc);
2464 a->head.alloc.func = &upb_arena_doalloc;
2465 a->block_alloc = alloc;
3425 static str_t *newstr(upb_alloc *alloc, const char *data, size_t len) {
3426 str_t *ret = upb_malloc(alloc, sizeof(*ret) + len);
4359 upb_alloc *alloc = upb_arena_alloc(symtab->arena);
4363 fields = upb_malloc(alloc, upb_msgdef_numfields(m) * sizeof(*fields));
4364 submsgs = upb_malloc(alloc, submsg_count * sizeof(*submsgs));
4529 upb_alloc *alloc; /* Allocate defs here. */
4537 return upb_strdup2(view.data, view.size, ctx->alloc);
4553 char *ret = upb_malloc(ctx->alloc, n + name.size + 2);
4603 static char* makejsonname(const char* name, upb_alloc *alloc) {
4605 char* json_name = upb_malloc(alloc, size);
4684 CHK_OOM(upb_strtable_insert3(&m->ntof, name.data, name.size, v, ctx->alloc));
4686 CHK_OOM(upb_inttable_init2(&o->itof, UPB_CTYPE_CONSTPTR, ctx->alloc));
4687 CHK_OOM(upb_strtable_init2(&o->ntof, UPB_CTYPE_CONSTPTR, ctx->alloc));
4775 f->defaultval.str = newstr(ctx->alloc, str, len);
4779 f->defaultval.str = newstr(ctx->alloc, str, len);
4805 f->defaultval.str = newstr(ctx->alloc, NULL, 0);
4818 upb_alloc *alloc = ctx->alloc;
4841 json_name = makejsonname(shortname, ctx->alloc);
4882 upb_strtable_insert3(&m->ntof, name.data, name.size, field_v, alloc));
4883 CHK_OOM(upb_inttable_insert2(&m->itof, field_number, v, alloc));
4886 upb_strtable_insert3(&m->ntof, json_name, json_size, json_v, alloc);
4960 CHK(upb_inttable_insert2(&oneof->itof, f->number_, v, alloc));
4961 CHK(upb_strtable_insert3(&oneof->ntof, name.data, name.size, v, alloc));
5001 CHK_OOM(upb_strtable_init2(&e->ntoi, UPB_CTYPE_INT32, ctx->alloc));
5002 CHK_OOM(upb_inttable_init2(&e->iton, UPB_CTYPE_CSTR, ctx->alloc));
5037 upb_strtable_insert3(&e->ntoi, name2, strlen(name2), v, ctx->alloc));
5041 CHK_OOM(upb_inttable_insert2(&e->iton, num, v, ctx->alloc));
5045 upb_inttable_compact2(&e->iton, ctx->alloc);
5068 CHK_OOM(upb_inttable_init2(&m->itof, UPB_CTYPE_CONSTPTR, ctx->alloc));
5069 CHK_OOM(upb_strtable_init2(&m->ntof, UPB_CTYPE_CONSTPTR, ctx->alloc));
5085 m->layout = upb_malloc(ctx->alloc, sizeof(*m->layout));
5090 m->oneofs = upb_malloc(ctx->alloc, sizeof(*m->oneofs) * n);
5097 m->fields = upb_malloc(ctx->alloc, sizeof(*m->fields) * n);
5105 upb_inttable_compact2(&m->itof, ctx->alloc);
5237 upb_alloc *alloc = ctx->alloc;
5248 file->msgs = upb_malloc(alloc, sizeof(*file->msgs) * counts.msg_count);
5249 file->enums = upb_malloc(alloc, sizeof(*file->enums) * counts.enum_count);
5250 file->exts = upb_malloc(alloc, sizeof(*file->exts) * counts.ext_count);
5313 file->deps = upb_malloc(alloc, sizeof(*file->deps) * n) ;
5344 file->exts = upb_malloc(alloc, sizeof(*file->exts) * n);
5375 upb_alloc *alloc = upb_arena_alloc(s->arena);
5379 upb_value_constptr(file), alloc));
5385 CHK_OOM(upb_strtable_insert3(&s->syms, key.data, key.size, value, alloc));
5444 upb_alloc *alloc;
5451 alloc = upb_arena_alloc(s->arena);
5453 if (!upb_strtable_init2(&s->syms, UPB_CTYPE_CONSTPTR, alloc) ||
5454 !upb_strtable_init2(&s->files, UPB_CTYPE_CONSTPTR, alloc)) {
5503 upb_alloc *alloc = upb_arena_alloc(s->arena);
5504 upb_filedef *file = upb_malloc(alloc, sizeof(*file));
5510 ctx.alloc = alloc;