- return Data_Wrap_Struct(klass, rb_redcarpet_rbase_mark, NULL, rndr);
+ return Data_Wrap_Struct(klass, rb_redcarpet_rbase_mark, xfree, rndr); - return Data_Wrap_Struct(klass, rb_redcarpet_rbase_mark, NULL, rndr);
+ return Data_Wrap_Struct(klass, rb_redcarpet_rbase_mark, xfree, rndr);I would have been even more explicit and added a cast to the expected structure pointer type. Entirely useless, except to the human reader.
I'd say use a separate free function when it needs one, which is not the case yet (and might never be.)
I don't mind adding 1 useless function per complex type if it saves me those headaches even a small minority of the time, or for the next maintainer. Opinions may differ, but that's me.
[1] http://clalance.blogspot.com/2011/01/writing-ruby-extensions... [2] http://inferior-products.com/docs/userdocs/ruby19/html/d8/d1...
Publib then? I'm finding this when I search: http://man.cx/xfree(3) http://man.cx/publib(3)
Also, are you sure? I see xmalloc in glibc all over the internet...
#define xmalloc ruby_xmalloc #define xfree ruby_xfree