diff options
author | Josh Haberman <haberman@google.com> | 2013-02-15 16:27:18 -0800 |
---|---|---|
committer | Josh Haberman <haberman@google.com> | 2013-02-15 16:27:18 -0800 |
commit | 7d3e2bd2c4cfd1296d1d6f996d7548de26540d41 (patch) | |
tree | b4b35967b3322c65cfb1a32220e8718de09d85fc /upb/pb/glue.c | |
parent | ea198bdcf947ba4bd51474bdd4f7b82b5e4cf41d (diff) |
Sync with 8 months of Google-internal development.
Many things have changed and been simplified.
The memory-management story for upb_def and upb_handlers
is much more robust; upb_def and upb_handlers should be
fairly stable interfaces now. There is still much work
to do for the runtime component (upb_sink).
Diffstat (limited to 'upb/pb/glue.c')
-rw-r--r-- | upb/pb/glue.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/upb/pb/glue.c b/upb/pb/glue.c index 40b901d..4e69c0c 100644 --- a/upb/pb/glue.c +++ b/upb/pb/glue.c @@ -5,10 +5,14 @@ * Author: Josh Haberman <jhaberman@gmail.com> */ +#include "upb/pb/glue.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "upb/bytestream.h" #include "upb/descriptor/reader.h" #include "upb/pb/decoder.h" -#include "upb/pb/glue.h" upb_def **upb_load_defs_from_descriptor(const char *str, size_t len, int *n, void *owner, upb_status *status) { @@ -16,16 +20,14 @@ upb_def **upb_load_defs_from_descriptor(const char *str, size_t len, int *n, upb_stringsrc_init(&strsrc); upb_stringsrc_reset(&strsrc, str, len); - upb_handlers *h = upb_handlers_new(); - upb_descreader_reghandlers(h); - + const upb_handlers *h = upb_descreader_newhandlers(&h); upb_decoderplan *p = upb_decoderplan_new(h, false); upb_decoder d; upb_decoder_init(&d); - upb_handlers_unref(h); + upb_handlers_unref(h, &h); upb_descreader r; upb_descreader_init(&r); - upb_decoder_resetplan(&d, p, 0); + upb_decoder_resetplan(&d, p); upb_decoder_resetinput(&d, upb_stringsrc_allbytes(&strsrc), &r); upb_success_t ret = upb_decoder_decode(&d); |