Skip to content

Commit

Permalink
Remove useless DATA_PTR call
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Nov 30, 2023
1 parent 43c1ab3 commit 5260f15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/oj/fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,6 @@ static VALUE parse_json(VALUE clas, char *json, bool given) {
doc->json = json;
self = TypedData_Wrap_Struct(clas, &oj_doc_type, doc);
doc->self = self;
DATA_PTR(doc->self) = doc;
result = rb_protect(protect_open_proc, (VALUE)&pi, &ex);
if (given || 0 != ex) {
DATA_PTR(doc->self) = NULL;
Expand Down Expand Up @@ -1609,7 +1608,9 @@ static VALUE doc_dump(int argc, VALUE *argv, VALUE self) {
* Oj::Doc.open('[1,2,3]') { |doc| doc.size() } #=> 4
*/
static VALUE doc_size(VALUE self) {
return ULONG2NUM(((Doc)DATA_PTR(self))->size);
Doc d;
TypedData_Get_Struct(self, struct _doc, &oj_doc_type, d);
return ULONG2NUM(d->size);
}

/* @overload close() => nil
Expand Down

0 comments on commit 5260f15

Please sign in to comment.