diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2017-06-02 13:15:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-02 13:15:16 -0700 |
commit | 82cbdc86acd060269913a36f86f437db41bd740b (patch) | |
tree | 44e4c9d5c8a0141246690f295a17b06dc5efec55 /upb | |
parent | 04fcf0b112deab5bf83673e78e3825155d6fdee1 (diff) | |
parent | 35f838e82ddfeb187cd275f2add96bf776019af5 (diff) |
Merge pull request #85 from TeBoring/pull2
php_namespace should be explicitly set even if it's empty.
Diffstat (limited to 'upb')
-rw-r--r-- | upb/descriptor/reader.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/upb/descriptor/reader.c b/upb/descriptor/reader.c index f982300..624c3ae 100644 --- a/upb/descriptor/reader.c +++ b/upb/descriptor/reader.c @@ -237,6 +237,18 @@ static size_t file_onpackage(void *closure, const void *hd, const char *buf, return n; } +static void *file_startphpnamespace(void *closure, const void *hd, + size_t size_hint) { + upb_descreader *r = closure; + bool ok; + UPB_UNUSED(hd); + UPB_UNUSED(size_hint); + + ok = upb_filedef_setphpnamespace(r->file, "", NULL); + UPB_ASSERT(ok); + return closure; +} + static size_t file_onphpnamespace(void *closure, const void *hd, const char *buf, size_t n, const upb_bufhandle *handle) { @@ -797,6 +809,8 @@ static void reghandlers(const void *closure, upb_handlers *h) { } else if (upbdefs_google_protobuf_FileOptions_is(m)) { upb_handlers_setstring(h, F(FileOptions, php_class_prefix), &file_onphpprefix, NULL); + upb_handlers_setstartstr(h, F(FileOptions, php_namespace), + &file_startphpnamespace, NULL); upb_handlers_setstring(h, F(FileOptions, php_namespace), &file_onphpnamespace, NULL); } |