summaryrefslogtreecommitdiffstats
path: root/ext/bigdecimal
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-31 10:30:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-31 10:30:33 +0000
commita1fd7d2ae86fd7627d74f216c187954a9ac3824a (patch)
treea14ada29405880c7f56c615067b6600815f54334 /ext/bigdecimal
parent4ae021c31c797c0951d8c3bb2263890c4f073369 (diff)
downloadruby-a1fd7d2ae86fd7627d74f216c187954a9ac3824a.tar.gz
ruby-a1fd7d2ae86fd7627d74f216c187954a9ac3824a.tar.xz
ruby-a1fd7d2ae86fd7627d74f216c187954a9ac3824a.zip
* ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members. (RSTRING_PTR): ditto. * string.c: use RSTRING_LEN and RSTRING_PTR. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r--ext/bigdecimal/bigdecimal.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index eb0d2b390..4aa9b2719 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -224,14 +224,14 @@ GetVpValue(VALUE v, int must)
#ifdef ENABLE_NUMERIC_STRING
case T_STRING:
SafeStringValue(v);
- return VpCreateRbObject(strlen(RSTRING(v)->ptr) + VpBaseFig() + 1,
- RSTRING(v)->ptr);
+ return VpCreateRbObject(strlen(RSTRING_PTR(v)) + VpBaseFig() + 1,
+ RSTRING_PTR(v));
#endif /* ENABLE_NUMERIC_STRING */
case T_BIGNUM:
bg = rb_big2str(v, 10);
- return VpCreateRbObject(strlen(RSTRING(bg)->ptr) + VpBaseFig() + 1,
- RSTRING(bg)->ptr);
+ return VpCreateRbObject(strlen(RSTRING_PTR(bg)) + VpBaseFig() + 1,
+ RSTRING_PTR(bg));
default:
goto SomeOneMayDoIt;
}
@@ -240,7 +240,7 @@ SomeOneMayDoIt:
if(must) {
rb_raise(rb_eTypeError, "%s can't be coerced into BigDecimal",
rb_special_const_p(v)?
- RSTRING(rb_inspect(v))->ptr:
+ RSTRING_PTR(rb_inspect(v)):
rb_obj_classname(v)
);
}
@@ -332,7 +332,7 @@ BigDecimal_load(VALUE self, VALUE str)
unsigned long m=0;
SafeStringValue(str);
- pch = RSTRING(str)->ptr;
+ pch = RSTRING_PTR(str);
/* First get max prec */
while((*pch)!=(unsigned char)'\0' && (ch=*pch++)!=(unsigned char)':') {
if(!ISDIGIT(ch)) {
@@ -1510,7 +1510,7 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
if(rb_scan_args(argc,argv,"01",&f)==1) {
if(TYPE(f)==T_STRING) {
SafeStringValue(f);
- psz = RSTRING(f)->ptr;
+ psz = RSTRING_PTR(f);
if(*psz==' ') {
fPlus = 1; psz++;
} else if(*psz=='+') {
@@ -1687,7 +1687,7 @@ BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
mf = GetPositiveInt(nFig);
}
SafeStringValue(iniValue);
- GUARD_OBJ(pv,VpCreateRbObject(mf, RSTRING(iniValue)->ptr));
+ GUARD_OBJ(pv,VpCreateRbObject(mf, RSTRING_PTR(iniValue)));
return ToValue(pv);
}
@@ -1718,7 +1718,7 @@ BigDecimal_new(int argc, VALUE *argv, VALUE self)
mf = GetPositiveInt(nFig);
}
SafeStringValue(iniValue);
- GUARD_OBJ(pv,VpNewRbClass(mf, RSTRING(iniValue)->ptr,self));
+ GUARD_OBJ(pv,VpNewRbClass(mf, RSTRING_PTR(iniValue),self));
return ToValue(pv);
}