summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-07 08:34:10 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-07 08:34:10 +0000
commitba06b1a81f81e089849c7c877eba7b1d3618b126 (patch)
tree57e77c2ade50f201b4aafdc071cf86fb95eb7016 /string.c
parentf8fc9136223c83c2791566d3efa52843f89aa127 (diff)
dynamic (nested) local variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/string.c b/string.c
index 178c256798d..17f31b085df 100644
--- a/string.c
+++ b/string.c
@@ -204,7 +204,11 @@ str_plus(str1, str2)
{
VALUE str3;
+#if 0
str2 = obj_as_string(str2);
+#else
+ Check_Type(str2, T_STRING);
+#endif
str3 = str_new(0, RSTRING(str1)->len+RSTRING(str2)->len);
memcpy(RSTRING(str3)->ptr, RSTRING(str1)->ptr, RSTRING(str1)->len);
memcpy(RSTRING(str3)->ptr+RSTRING(str1)->len, RSTRING(str2)->ptr, RSTRING(str2)->len);
@@ -422,7 +426,11 @@ static VALUE
str_concat(str1, str2)
VALUE str1, str2;
{
+#if 0
str2 = obj_as_string(str2);
+#else
+ Check_Type(str2, T_STRING);
+#endif
str_cat(str1, RSTRING(str2)->ptr, RSTRING(str2)->len);
return str1;
}
@@ -499,7 +507,11 @@ str_cmp_method(str1, str2)
{
int result;
+#if 0
str2 = obj_as_string(str2);
+#else
+ Check_Type(str2, T_STRING);
+#endif
result = str_cmp(str1, str2);
return INT2FIX(result);
}
@@ -1386,7 +1398,7 @@ str_inspect(str)
*b++ = c;
*b++ = *p++;
}
- if (c & 0x80) {
+ else if (c & 0x80) {
CHECK(1);
*b++ = c;
}
@@ -2459,7 +2471,8 @@ str_crypt(str, salt)
VALUE str, salt;
{
extern char *crypt();
- salt = obj_as_string(salt);
+
+ Check_Type(salt, T_STRING);
if (RSTRING(salt)->len < 2)
ArgError("salt too short(need >2 bytes)");
return str_new2(crypt(RSTRING(str)->ptr, RSTRING(salt)->ptr));