diff options
author | Bo Yang <teboring@google.com> | 2017-03-14 17:18:17 -0700 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2017-03-14 17:23:07 -0700 |
commit | 4169481438e27bd548b9e759664343006a92710d (patch) | |
tree | ee51458187a04e4696672618f0014f1988684ace | |
parent | e35c38fc6535f811ca405e35c1271efc28f511b3 (diff) |
Fix bugs in file_onphpprefix
1. It should call file_setphpprefix instead.
2. Collect prefix.
3. Return size of string.
-rw-r--r-- | upb/descriptor/reader.c | 5 |
1 files changed, 3 insertions, 2 deletions
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, |