mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
use STR2CSTR
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@46 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7a249d7acc
commit
2f99f3b41a
3 changed files with 14 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
Thu Jan 22 00:37:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Thu Jan 22 00:37:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* ruby.h (STR2CSTR): new macro to retrieve char*.
|
||||||
|
|
||||||
* class.c (rb_define_method): `initialize' should always be
|
* class.c (rb_define_method): `initialize' should always be
|
||||||
private, even if it defined by C extensions.
|
private, even if it defined by C extensions.
|
||||||
|
|
||||||
|
|
9
object.c
9
object.c
|
@ -721,6 +721,15 @@ f_string(obj, arg)
|
||||||
return rb_funcall(arg, rb_intern("to_s"), 0);
|
return rb_funcall(arg, rb_intern("to_s"), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char*
|
||||||
|
str2cstr(str)
|
||||||
|
VALUE str;
|
||||||
|
{
|
||||||
|
if (NIL_P(str)) return NULL;
|
||||||
|
Check_Type(str, T_STRING);
|
||||||
|
return RSTRING(str)->ptr;
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_String(val)
|
rb_String(val)
|
||||||
VALUE val;
|
VALUE val;
|
||||||
|
|
3
ruby.h
3
ruby.h
|
@ -165,6 +165,9 @@ int num2int _((VALUE));
|
||||||
double num2dbl _((VALUE));
|
double num2dbl _((VALUE));
|
||||||
#define NUM2DBL(x) num2dbl((VALUE)(x))
|
#define NUM2DBL(x) num2dbl((VALUE)(x))
|
||||||
|
|
||||||
|
char *str2cstr _((VALUE));
|
||||||
|
#define STR2CSTR(x) str2cstr((VALUE)(x))
|
||||||
|
|
||||||
VALUE rb_newobj _((void));
|
VALUE rb_newobj _((void));
|
||||||
#define NEWOBJ(obj,type) type *obj = (type*)rb_newobj()
|
#define NEWOBJ(obj,type) type *obj = (type*)rb_newobj()
|
||||||
#define OBJSETUP(obj,c,t) {\
|
#define OBJSETUP(obj,c,t) {\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue