Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lfittl committed Apr 4, 2021
1 parent 2c354c6 commit 07f263c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions ruby/ext/google/protobuf_c/defs.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,9 +879,7 @@ static VALUE FieldDescriptor_json_name(VALUE _self) {
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
const upb_fielddef *f = self->fielddef;
const char *json_name = upb_fielddef_jsonname(f);
if (json_name != NULL)
return rb_str_new2(json_name);
return Qnil;
return rb_str_new2(json_name);
}

/*
Expand Down Expand Up @@ -1773,9 +1771,6 @@ static void msgdef_add_field(VALUE msgbuilder_rb, upb_label_t label, VALUE name,
VALUE json_name =
rb_hash_lookup(options, ID2SYM(rb_intern("json_name")));

/* Call #to_s since json_name is always a string in the descriptor. */
json_name = rb_funcall(json_name, rb_intern("to_s"), 0);

google_protobuf_FieldDescriptorProto_set_json_name(
field_proto,
FileBuilderContext_strdup(self->file_builder, json_name));
Expand Down

0 comments on commit 07f263c

Please sign in to comment.