From 32e3f394b42cff2b94c5ef84cb31009ce33c864f Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Fri, 1 Feb 2019 16:34:52 -0800 Subject: A few small API tweaks. - Foo_parsenew() -> Foo_parse(). - parse function takes plain (const char*, size_t) instead of upb_strview. The latter is mainly useful for strings inside message objects. --- upb/decode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'upb/decode.c') diff --git a/upb/decode.c b/upb/decode.c index c54ee3c..5315187 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -584,11 +584,12 @@ static bool upb_decode_message(upb_decstate *d, const char *limit, return true; } -bool upb_decode(upb_strview buf, void *msg, const upb_msglayout *l) { +bool upb_decode(const char *buf, size_t size, void *msg, + const upb_msglayout *l) { upb_decstate state; - state.ptr = buf.data; + state.ptr = buf; - return upb_decode_message(&state, buf.data + buf.size, 0, msg, l); + return upb_decode_message(&state, buf + size, 0, msg, l); } #undef CHK -- cgit v1.2.3