From 2282d2489bd8db3cd4ddbe0dd813732bffcf6452 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 12 Aug 2009 13:47:24 -0700 Subject: Refactoring: unify upb_msg. The cost is that a upb_msg will now always have an overhead of 2*sizeof(void*). This is comparable to proto2 overhead. The benefit is that upb_msg is now self-describing, and read-only algorithms can now operate on a upb_msg regardless of the memory-management scheme. Also, upb_array and upb_string now know inherently if they own their associated memory, and upb_array has a generic pointer for memory management purposes like upb_msg does. --- src/upb_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/upb_context.c') diff --git a/src/upb_context.c b/src/upb_context.c index 5e1833e..252cf17 100644 --- a/src/upb_context.c +++ b/src/upb_context.c @@ -60,7 +60,7 @@ void upb_context_free(struct upb_context *c) { free_symtab(&c->symtab); for(size_t i = 0; i < c->fds_len; i++) - upb_msg_free(c->fds[i], c->fds_msg); + upb_msg_free((struct upb_msg*)c->fds[i]); free_symtab(&c->psymtab); free(c->fds); } @@ -280,7 +280,7 @@ bool upb_context_addfds(struct upb_context *c, bool upb_context_parsefds(struct upb_context *c, struct upb_string *fds_str) { google_protobuf_FileDescriptorSet *fds = - upb_msg_parsenew(c->fds_msg, fds_str); + (google_protobuf_FileDescriptorSet*)upb_msg_parsenew(c->fds_msg, fds_str); if(!fds) return false; if(!upb_context_addfds(c, fds)) return false; -- cgit v1.2.3