summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-19 00:03:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-19 00:03:01 +0000
commit9bd744a09284411b8cd7817c762187174199d734 (patch)
treef3d21a1c19f8da7e5f24a9032aaea790ad51e99f /string.c
parent39324f819fbdf6edd27624b6aa8eb1d3c9d135cc (diff)
* indent and tabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/string.c b/string.c
index 0ead392222..3d3573a554 100644
--- a/string.c
+++ b/string.c
@@ -1169,7 +1169,7 @@ rb_str_rindex_m(argc, argv, str)
if (rb_scan_args(argc, argv, "11", &sub, &position) == 2) {
pos = NUM2LONG(position);
- if (pos < 0) {
+ if (pos < 0) {
pos += RSTRING(str)->len;
if (pos < 0) {
if (TYPE(sub) == T_REGEXP) {
@@ -1177,7 +1177,7 @@ rb_str_rindex_m(argc, argv, str)
}
return Qnil;
}
- }
+ }
if (pos > RSTRING(str)->len) pos = RSTRING(str)->len;
}
else {
@@ -1365,8 +1365,8 @@ rb_str_succ(orig)
sbeg = RSTRING(str)->ptr; s = sbeg + RSTRING(str)->len - 1;
c = '\001';
while (sbeg <= s) {
- if ((*s += 1) != 0) break;
- s--;
+ if ((*s += 1) != 0) break;
+ s--;
}
}
if (s < sbeg) {
@@ -3523,7 +3523,7 @@ rb_str_split_m(argc, argv, str)
if (!RSTRING(str)->ptr) {
rb_ary_push(result, rb_str_new("", 0));
break;
- }
+ }
else if (last_null == 1) {
rb_ary_push(result, rb_str_substr(str, beg, mbclen2(RSTRING(str)->ptr[beg],spat)));
beg = start;
@@ -3687,7 +3687,7 @@ rb_str_each_line(argc, argv, str)
}
if (s != pend) {
- if (p > pend) p = pend;
+ if (p > pend) p = pend;
line = rb_str_new5(str, s, p - s);
OBJ_INFECT(line, str);
rb_yield(line);
@@ -4473,41 +4473,41 @@ rb_str_justify(argc, argv, str, jflag)
}
p = RSTRING(res)->ptr;
if (jflag != 'l') {
- n = width - RSTRING(str)->len;
- pend = p + ((jflag == 'r') ? n : n/2);
- if (flen <= 1) {
- while (p < pend) {
- *p++ = *f;
- }
- }
- else {
- char *q = f;
- while (p + flen <= pend) {
- memcpy(p,f,flen);
- p += flen;
- }
- while (p < pend) {
- *p++ = *q++;
- }
- }
+ n = width - RSTRING(str)->len;
+ pend = p + ((jflag == 'r') ? n : n/2);
+ if (flen <= 1) {
+ while (p < pend) {
+ *p++ = *f;
+ }
+ }
+ else {
+ char *q = f;
+ while (p + flen <= pend) {
+ memcpy(p,f,flen);
+ p += flen;
+ }
+ while (p < pend) {
+ *p++ = *q++;
+ }
+ }
}
memcpy(p, RSTRING(str)->ptr, RSTRING(str)->len);
if (jflag != 'r') {
- p += RSTRING(str)->len; pend = RSTRING(res)->ptr + width;
- if (flen <= 1) {
- while (p < pend) {
- *p++ = *f;
- }
- }
- else {
- while (p + flen <= pend) {
- memcpy(p,f,flen);
- p += flen;
- }
- while (p < pend) {
- *p++ = *f++;
- }
- }
+ p += RSTRING(str)->len; pend = RSTRING(res)->ptr + width;
+ if (flen <= 1) {
+ while (p < pend) {
+ *p++ = *f;
+ }
+ }
+ else {
+ while (p + flen <= pend) {
+ memcpy(p,f,flen);
+ p += flen;
+ }
+ while (p < pend) {
+ *p++ = *f++;
+ }
+ }
}
OBJ_INFECT(res, str);
if (flen > 0) OBJ_INFECT(res, pad);