* eval.c (proc_to_s): refined format. [ruby-dev:18215]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d0c6f63804
commit
bfb1775244
@ -1,3 +1,7 @@
|
|||||||
|
Wed Sep 11 18:55:38 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
|
* eval.c (proc_to_s): refined format. [ruby-dev:18215]
|
||||||
|
|
||||||
Wed Sep 11 17:47:17 2002 NAKAMURA Usaku <usa@ruby-lang.org>
|
Wed Sep 11 17:47:17 2002 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* win32/win32.c, win32/win32.h (rb_w32_getpid): negate pid under Win9x.
|
* win32/win32.c, win32/win32.h (rb_w32_getpid): negate pid under Win9x.
|
||||||
|
9
eval.c
9
eval.c
@ -6630,19 +6630,20 @@ proc_to_s(self, other)
|
|||||||
{
|
{
|
||||||
struct BLOCK *data;
|
struct BLOCK *data;
|
||||||
char *cname = rb_class2name(CLASS_OF(self));
|
char *cname = rb_class2name(CLASS_OF(self));
|
||||||
long len = strlen(cname)+6+16+1; /* 6:tags 16:addr 1:nul */
|
const int w = (SIZEOF_LONG * CHAR_BIT) / 4;
|
||||||
|
long len = strlen(cname)+6+w; /* 6:tags 16:addr */
|
||||||
VALUE str;
|
VALUE str;
|
||||||
|
|
||||||
Data_Get_Struct(self, struct BLOCK, data);
|
Data_Get_Struct(self, struct BLOCK, data);
|
||||||
if (data->body) {
|
if (data->body) {
|
||||||
len += strlen(data->body->nd_file)+16;
|
len += strlen(data->body->nd_file) + 2 + (SIZEOF_LONG*CHAR_BIT-NODE_LSHIFT)/3;
|
||||||
str = rb_str_new(0, len);
|
str = rb_str_new(0, len);
|
||||||
sprintf(RSTRING(str)->ptr, "#<%s:0x%p@%s:%d>", cname, data->tag,
|
sprintf(RSTRING(str)->ptr, "#<%s:0x%.*lx@%s:%d>", cname, w, (VALUE)data->tag,
|
||||||
data->body->nd_file, nd_line(data->body));
|
data->body->nd_file, nd_line(data->body));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
str = rb_str_new(0, len);
|
str = rb_str_new(0, len);
|
||||||
sprintf(RSTRING(str)->ptr, "#<%s:0x%p>", cname, data->tag);
|
sprintf(RSTRING(str)->ptr, "#<%s:0x%.*lx>", cname, w, (VALUE)data->tag);
|
||||||
}
|
}
|
||||||
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
||||||
if (OBJ_TAINTED(self)) OBJ_TAINT(str);
|
if (OBJ_TAINTED(self)) OBJ_TAINT(str);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user