summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-07-13 04:38:01 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-07-13 04:38:01 +0000
commit35c6e6af5ba2c405a91dc6b9e4af833d0979ed22 (patch)
tree7f54dda0bcda0a58eb5229def03ce3015c98a2b5 /string.c
parent71d408a6c3298b229c0f1d2ff7159ca410a4c612 (diff)
str2cstr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/string.c b/string.c
index 013238d8ce0..16bf6fd6b68 100644
--- a/string.c
+++ b/string.c
@@ -2005,15 +2005,14 @@ str_split_method(argc, argv, str)
int beg, end, lim, i;
VALUE result, tmp;
- rb_scan_args(argc, argv, "02", &spat, &limit);
- if (!NIL_P(limit)) {
+ if (rb_scan_args(argc, argv, "02", &spat, &limit) == 2) {
lim = NUM2INT(limit);
if (lim == 0) limit = Qnil;
else if (lim == 1) return ary_new3(1, str);
i = 1;
}
- if (NIL_P(spat)) {
+ if (argc == 0) {
if (!NIL_P(FS)) {
spat = FS;
goto fs_set;
@@ -2508,8 +2507,9 @@ str_sum(argc, argv, str)
int bits;
char *p, *pend;
- rb_scan_args(argc, argv, "01", &vbits);
- if (NIL_P(vbits)) bits = 16;
+ if (rb_scan_args(argc, argv, "01", &vbits) == 0) {
+ bits = 16;
+ }
else bits = NUM2INT(vbits);
p = RSTRING(str)->ptr; pend = p + RSTRING(str)->len;