mirror of
https://github.com/ruby/ruby.git
synced 2025-08-16 05:59:00 +02:00
* error.c (syserr_initialize): add 1 byte for snprintf() size for
NUL at the end. [ruby-dev:26574] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
395ca33bff
commit
bdb357e0d2
5 changed files with 11 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
|||
Tue Jul 19 22:47:29 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* error.c (syserr_initialize): need to allocate an additional byte
|
||||
for NUL at the end. [ruby-dev:26574]
|
||||
* error.c (syserr_initialize): add 1 byte for snprintf() size for
|
||||
NUL at the end. [ruby-dev:26574]
|
||||
|
||||
Tue Jul 19 16:39:46 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
|
|
4
error.c
4
error.c
|
@ -907,10 +907,10 @@ syserr_initialize(argc, argv, self)
|
|||
else err = "unknown error";
|
||||
if (!NIL_P(mesg)) {
|
||||
VALUE str = mesg;
|
||||
size_t len = strlen(err)+RSTRING(str)->len+4;
|
||||
size_t len = strlen(err)+RSTRING(str)->len+3;
|
||||
StringValue(str);
|
||||
mesg = rb_str_new(0, len);
|
||||
snprintf(RSTRING(mesg)->ptr, len, "%s - %.*s", err,
|
||||
snprintf(RSTRING(mesg)->ptr, len+1, "%s - %.*s", err,
|
||||
(int)RSTRING(str)->len, RSTRING(str)->ptr);
|
||||
rb_str_resize(mesg, strlen(RSTRING(mesg)->ptr));
|
||||
}
|
||||
|
|
4
eval.c
4
eval.c
|
@ -8510,13 +8510,13 @@ proc_to_s(self)
|
|||
if ((node = data->frame.node) || (node = data->body)) {
|
||||
len += strlen(node->nd_file) + 2 + (SIZEOF_LONG*CHAR_BIT-NODE_LSHIFT)/3;
|
||||
str = rb_str_new(0, len);
|
||||
snprintf(RSTRING(str)->ptr, len,
|
||||
snprintf(RSTRING(str)->ptr, len+1,
|
||||
"#<%s:0x%.*lx@%s:%d>", cname, w, (VALUE)data->body,
|
||||
node->nd_file, nd_line(node));
|
||||
}
|
||||
else {
|
||||
str = rb_str_new(0, len);
|
||||
snprintf(RSTRING(str)->ptr, len,
|
||||
snprintf(RSTRING(str)->ptr, len+1,
|
||||
"#<%s:0x%.*lx>", cname, w, (VALUE)data->body);
|
||||
}
|
||||
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
||||
|
|
6
object.c
6
object.c
|
@ -357,9 +357,9 @@ rb_any_to_s(obj)
|
|||
size_t len;
|
||||
VALUE str;
|
||||
|
||||
len = strlen(cname)+6+16+1;
|
||||
str = rb_str_new(0, len); /* 6:tags 16:addr 1:nul */
|
||||
snprintf(RSTRING(str)->ptr, len, "#<%s:0x%lx>", cname, obj);
|
||||
len = strlen(cname)+6+16;
|
||||
str = rb_str_new(0, len); /* 6:tags 16:addr */
|
||||
snprintf(RSTRING(str)->ptr, len+1, "#<%s:0x%lx>", cname, obj);
|
||||
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
||||
if (OBJ_TAINTED(obj)) OBJ_TAINT(str);
|
||||
|
||||
|
|
4
struct.c
4
struct.c
|
@ -518,10 +518,10 @@ rb_struct_inspect(s)
|
|||
{
|
||||
if (rb_inspecting_p(s)) {
|
||||
char *cname = rb_class2name(rb_obj_class(s));
|
||||
size_t len = strlen(cname) + 15;
|
||||
size_t len = strlen(cname) + 14;
|
||||
VALUE str = rb_str_new(0, len);
|
||||
|
||||
snprintf(RSTRING(str)->ptr, len, "#<struct %s:...>", cname);
|
||||
snprintf(RSTRING(str)->ptr, len+1, "#<struct %s:...>", cname);
|
||||
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue