ruby-changes:32535
From: nobu <ko1@a...>
Date: Wed, 15 Jan 2014 17:17:10 +0900 (JST)
Subject: [ruby-changes:32535] nobu:r44614 (trunk): ext/fiddle: backward compatibilities
nobu 2014-01-15 17:16:44 +0900 (Wed, 15 Jan 2014) New Revision: 44614 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44614 Log: ext/fiddle: backward compatibilities * ext/fiddle/function.c, ext/fiddle/pointer.c: add macros for backward compatibilities. Modified files: trunk/ext/fiddle/function.c trunk/ext/fiddle/pointer.c Index: ext/fiddle/pointer.c =================================================================== --- ext/fiddle/pointer.c (revision 44613) +++ ext/fiddle/pointer.c (revision 44614) @@ -7,6 +7,15 @@ https://github.com/ruby/ruby/blob/trunk/ext/fiddle/pointer.c#L7 #include <ctype.h> #include <fiddle.h> +#ifdef PRIsVALUE +# define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj) +# define RB_OBJ_STRING(obj) (obj) +#else +# define PRIsVALUE "s" +# define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj) +# define RB_OBJ_STRING(obj) StringValueCStr(obj) +#endif + VALUE rb_cPointer; typedef void (*freefunc_t)(void*); @@ -430,7 +439,7 @@ rb_fiddle_ptr_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/fiddle/pointer.c#L439 TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data); return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>", - rb_obj_class(self), data, data->ptr, data->size, data->free); + RB_OBJ_CLASSNAME(self), data, data->ptr, data->size, data->free); } /* Index: ext/fiddle/function.c =================================================================== --- ext/fiddle/function.c (revision 44613) +++ ext/fiddle/function.c (revision 44614) @@ -1,5 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ext/fiddle/function.c#L1 #include <fiddle.h> +#ifdef PRIsVALUE +# define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj) +# define RB_OBJ_STRING(obj) (obj) +#else +# define PRIsVALUE "s" +# define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj) +# define RB_OBJ_STRING(obj) StringValueCStr(obj) +#endif + VALUE cFiddleFunction; static void @@ -56,7 +65,8 @@ parse_keyword_arg_i(VALUE key, VALUE val https://github.com/ruby/ruby/blob/trunk/ext/fiddle/function.c#L65 if (key == ID2SYM(rb_intern("name"))) { rb_iv_set(self, "@name", value); } else { - rb_raise(rb_eArgError, "unknown keyword: %"PRIsVALUE, key); + rb_raise(rb_eArgError, "unknown keyword: %"PRIsVALUE, + RB_OBJ_STRING(key)); } return ST_CONTINUE; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/