summaryrefslogtreecommitdiff
path: root/upb
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2019-01-16 18:50:46 -0800
committerJoshua Haberman <jhaberman@gmail.com>2019-01-16 18:50:46 -0800
commit01557462cc211cec9c7bddede77995b938067ea5 (patch)
treed06853c0af2d947a260a734c3b94089c5ddd8269 /upb
parent84fb01ad0f7301b416e03d97fbffef1a7512e7ea (diff)
upb_symtab_add() returns upb_filedef* instead of bool.
Diffstat (limited to 'upb')
-rw-r--r--upb/def.c8
-rw-r--r--upb/def.h13
2 files changed, 11 insertions, 10 deletions
diff --git a/upb/def.c b/upb/def.c
index aedd88d..4a893d1 100644
--- a/upb/def.c
+++ b/upb/def.c
@@ -1649,9 +1649,9 @@ static bool upb_symtab_addtotabs(upb_symtab *s, symtab_addctx *ctx,
return true;
}
-bool upb_symtab_addfile(upb_symtab *s,
- const google_protobuf_FileDescriptorProto *file_proto,
- upb_status *status) {
+const upb_filedef *upb_symtab_addfile(
+ upb_symtab *s, const google_protobuf_FileDescriptorProto *file_proto,
+ upb_status *status) {
upb_arena *tmparena = upb_arena_new();
upb_strtable addtab;
upb_alloc *alloc = upb_arena_alloc(s->arena);
@@ -1672,7 +1672,7 @@ bool upb_symtab_addfile(upb_symtab *s,
upb_symtab_addtotabs(s, &ctx, status);
upb_arena_free(tmparena);
- return ok;
+ return ok ? file : NULL;
}
/* Include here since we want most of this file to be stdio-free. */
diff --git a/upb/def.h b/upb/def.h
index 4fd8509..7675138 100644
--- a/upb/def.h
+++ b/upb/def.h
@@ -788,9 +788,9 @@ const upb_msgdef *upb_symtab_lookupmsg2(
const upb_symtab *s, const char *sym, size_t len);
const upb_enumdef *upb_symtab_lookupenum(const upb_symtab *s, const char *sym);
int upb_symtab_filecount(const upb_symtab *s);
-bool upb_symtab_addfile(upb_symtab *s,
- const google_protobuf_FileDescriptorProto* file,
- upb_status *status);
+const upb_filedef *upb_symtab_addfile(
+ upb_symtab *s, const google_protobuf_FileDescriptorProto *file,
+ upb_status *status);
/* For generated code only: loads a generated descriptor. */
typedef struct upb_def_init {
@@ -826,9 +826,10 @@ class upb::SymbolTable {
/* TODO: iteration? */
/* Adds the given serialized FileDescriptorProto to the pool. */
- bool AddFile(const google_protobuf_FileDescriptorProto *file_proto,
- Status *status) {
- return upb_symtab_addfile(ptr_.get(), file_proto, status->ptr());
+ FileDefPtr AddFile(const google_protobuf_FileDescriptorProto *file_proto,
+ Status *status) {
+ return FileDefPtr(
+ upb_symtab_addfile(ptr_.get(), file_proto, status->ptr()));
}
private:
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback