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. --- upbc/generator.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'upbc') diff --git a/upbc/generator.cc b/upbc/generator.cc index 42e249e..6c0179a 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -325,9 +325,10 @@ void GenerateMessageInHeader(const protobuf::Descriptor* message, Output& output "UPB_INLINE $0 *$0_new(upb_arena *arena) {\n" " return ($0 *)upb_msg_new(&$1, arena);\n" "}\n" - "UPB_INLINE $0 *$0_parsenew(upb_strview buf, upb_arena *arena) {\n" + "UPB_INLINE $0 *$0_parse(const char *buf, size_t size,\n" + " upb_arena *arena) {\n" " $0 *ret = $0_new(arena);\n" - " return (ret && upb_decode(buf, ret, &$1)) ? ret : NULL;\n" + " return (ret && upb_decode(buf, size, ret, &$1)) ? ret : NULL;\n" "}\n" "UPB_INLINE char *$0_serialize(const $0 *msg, upb_arena *arena, size_t " "*len) {\n" -- cgit v1.2.3