mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ext/fiddle: backward compatibilities
* ext/fiddle/function.c, ext/fiddle/pointer.c: add macros for backward compatibilities. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
eb6575e137
commit
a1a237fb36
2 changed files with 21 additions and 2 deletions
|
@ -1,5 +1,14 @@
|
||||||
#include <fiddle.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 cFiddleFunction;
|
VALUE cFiddleFunction;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -56,7 +65,8 @@ parse_keyword_arg_i(VALUE key, VALUE value, VALUE self)
|
||||||
if (key == ID2SYM(rb_intern("name"))) {
|
if (key == ID2SYM(rb_intern("name"))) {
|
||||||
rb_iv_set(self, "@name", value);
|
rb_iv_set(self, "@name", value);
|
||||||
} else {
|
} else {
|
||||||
rb_raise(rb_eArgError, "unknown keyword: %"PRIsVALUE, key);
|
rb_raise(rb_eArgError, "unknown keyword: %"PRIsVALUE,
|
||||||
|
RB_OBJ_STRING(key));
|
||||||
}
|
}
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,15 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <fiddle.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;
|
VALUE rb_cPointer;
|
||||||
|
|
||||||
typedef void (*freefunc_t)(void*);
|
typedef void (*freefunc_t)(void*);
|
||||||
|
@ -430,7 +439,7 @@ rb_fiddle_ptr_inspect(VALUE self)
|
||||||
|
|
||||||
TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
|
TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
|
||||||
return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>",
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue