diff options
author | Chris Fallin <cfallin@google.com> | 2015-01-14 18:02:27 -0800 |
---|---|---|
committer | Chris Fallin <cfallin@google.com> | 2015-01-14 18:02:27 -0800 |
commit | e2debef5d8cd084946bd14fecabda5c328382114 (patch) | |
tree | 341b296a4b919ef37da1fb84b26c90e0bc9f753b /ruby/ext/google/protobuf_c/encode_decode.c | |
parent | e1b7d38d9ad5dfd3719b1e9b1d588e08aba1afe8 (diff) | |
download | protobuf-e2debef5d8cd084946bd14fecabda5c328382114.tar.gz protobuf-e2debef5d8cd084946bd14fecabda5c328382114.tar.bz2 protobuf-e2debef5d8cd084946bd14fecabda5c328382114.zip |
Ruby extension: added oneof accessor.
Diffstat (limited to 'ruby/ext/google/protobuf_c/encode_decode.c')
-rw-r--r-- | ruby/ext/google/protobuf_c/encode_decode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ruby/ext/google/protobuf_c/encode_decode.c b/ruby/ext/google/protobuf_c/encode_decode.c index 5e53b694..0db86209 100644 --- a/ruby/ext/google/protobuf_c/encode_decode.c +++ b/ruby/ext/google/protobuf_c/encode_decode.c @@ -77,7 +77,8 @@ static const void *newoneofhandlerdata(upb_handlers *h, // we don't expose these numbers to the user, so the only requirement is that // we have some unique ID for each union case/possibility. The field tag // numbers are already present and are easy to use so there's no reason to - // create a separate ID space. + // create a separate ID space. In addition, using the field tag number here + // lets us easily look up the field in the oneof accessor. hd->oneof_case_num = upb_fielddef_number(f); if (upb_fielddef_type(f) == UPB_TYPE_MESSAGE) { hd->md = upb_fielddef_msgsubdef(f); |