From 4169481438e27bd548b9e759664343006a92710d Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 14 Mar 2017 17:18:17 -0700 Subject: Fix bugs in file_onphpprefix 1. It should call file_setphpprefix instead. 2. Collect prefix. 3. Return size of string. --- upb/descriptor/reader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'upb/descriptor') diff --git a/upb/descriptor/reader.c b/upb/descriptor/reader.c index 106d4a7..af3f83d 100644 --- a/upb/descriptor/reader.c +++ b/upb/descriptor/reader.c @@ -246,9 +246,10 @@ static size_t file_onphpprefix(void *closure, const void *hd, const char *buf, UPB_UNUSED(handle); prefix = upb_gstrndup(buf, n); - ok = upb_filedef_setpackage(r->file, prefix, NULL); + ok = upb_filedef_setphpprefix(r->file, prefix, NULL); + upb_gfree(prefix); UPB_ASSERT(ok); - return true; + return n; } static size_t file_onsyntax(void *closure, const void *hd, const char *buf, -- cgit v1.2.3