summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-16 02:11:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-16 02:11:21 +0000
commit44fcb03b2db8ae19912c34afd6f322f21e6cce5d (patch)
treea36d1a9660e2aac259d03ed3af06989b63877436 /ruby.c
parente03d60ddff663b2ed374c85efdf97e3d0a5bbd70 (diff)
* ruby.c (set_arg0): fill argv other than the first with an empty
string instead of NULL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/ruby.c b/ruby.c
index 7979051..39b209d 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1065,18 +1065,13 @@ set_arg0(val, id)
if (i >= len) {
i = len;
- memcpy(origargv[0], s, i);
- origargv[0][i] = '\0';
- }
- else {
- memcpy(origargv[0], s, i);
- s = origargv[0]+i;
- *s++ = '\0';
- while (++i < len)
- *s++ = ' ';
- for (i = 1; i < origargc; i++)
- origargv[i] = 0;
}
+ memcpy(origargv[0], s, i);
+ s = origargv[0] + i;
+ *s = '\0';
+ if (++i < len) memset(s + 1, ' ', len - i);
+ for (i = 1; i < origargc; i++)
+ origargv[i] = s;
rb_progname = rb_tainted_str_new2(origargv[0]);
#endif
}