diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-06-28 12:35:08 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-06-28 12:35:08 -0700 |
commit | 01fb1d45ed26068bcb32a2dbf4ba8e56e65475e9 (patch) | |
tree | 281feaa12d3bc024bfdf7542e5b30ca04d8ff4b9 /upb_context.c | |
parent | 1139650320e764b6ba3582174a13babaa88fb1a1 (diff) |
Stubbed out a few more methods in _msg and _context.
Diffstat (limited to 'upb_context.c')
-rw-r--r-- | upb_context.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/upb_context.c b/upb_context.c index 642270a..e2c7aa9 100644 --- a/upb_context.c +++ b/upb_context.c @@ -30,6 +30,7 @@ bool upb_context_init(struct upb_context *c) void upb_context_free(struct upb_context *c) { upb_strtable_free(&c->symtab); + for(size_t i = 0; i < c->fd_len; i++) free(c->fd[i]); } struct upb_symtab_entry *upb_context_lookup(struct upb_context *c, @@ -215,7 +216,7 @@ bool upb_context_addfd(struct upb_context *c, else continue; /* No resolving necessary. */ if(!ref.msg) goto error; - upb_msg_ref(m, f, &ref); + upb_msg_ref(m, f, ref); } } } @@ -227,5 +228,14 @@ bool upb_context_addfd(struct upb_context *c, return true; error: + /* TODO */ return false; } + +bool upb_context_parsefd(struct upb_context *c, struct upb_string *fd_str) { + google_protobuf_FileDescriptorProto *fd = upb_msg_parse(c->fd_msg, fd_str); + if(!fd) return false; + if(!upb_context_addfd(c, fd)) return false; + c->fd[c->fd_len++] = fd; /* Need to keep a ref since we own it. */ + return true; +} |