summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-27 03:07:02 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-27 03:07:02 +0000
commita12c1e4bd25c4600e809eb6271ef13ed5f8d5c17 (patch)
treeb498407cbc7ca7aabd9a70fb6d9fde54f493e8ce
parentf933f9d3a5e5d71bcebc5d0a3206149870c412e0 (diff)
revered all LLP64 modifies due to portability reason.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog21
-rw-r--r--eval.c20
-rw-r--r--gc.c20
-rw-r--r--object.c6
-rw-r--r--ruby.h9
-rw-r--r--sprintf.c7
-rw-r--r--variable.c2
7 files changed, 23 insertions, 62 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e3494e..dd7be4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,29 +1,8 @@
-Wed Jul 27 10:43:14 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (id2ref): must not assign pointers to long int. use
- LONG_LONG instead if SIZEOF_LONG < SIZEOF_VOIDP.
- [ruby-talk:149645]
-
- * ruby.h: use LONG_LONG to simplify the change.
- [ruby-talk:149645]
-
Wed Jul 27 10:59:02 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (dir_each): rewinddir(3) before iteration.
[ruby-talk:149628]
-Wed Jul 27 02:34:58 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_f_throw): replace all '0x%lx' by '%p'.
- [ruby-talk:149553]
-
- * missing/vsnprintf.c (BSD_vfprintf): '%p' need to handle 64bit
- size pointer. [ruby-talk:149553]
-
-Tue Jul 26 18:11:33 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ruby.h: support LLP64 model. [ruby-talk:149524]
-
Tue Jul 26 12:57:49 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/openssl_missin.c: include <openssl/engine.h> before
diff --git a/eval.c b/eval.c
index ef32c78..90f8d69 100644
--- a/eval.c
+++ b/eval.c
@@ -5848,7 +5848,7 @@ rb_call(klass, recv, mid, argc, argv, scope)
struct cache_entry *ent;
if (!klass) {
- rb_raise(rb_eNotImpError, "method `%s' called on terminated object (%p)",
+ rb_raise(rb_eNotImpError, "method `%s' called on terminated object (0x%lx)",
rb_id2name(mid), recv);
}
/* is it in the method cache? */
@@ -8511,13 +8511,13 @@ proc_to_s(self)
len += strlen(node->nd_file) + 2 + (SIZEOF_LONG*CHAR_BIT-NODE_LSHIFT)/3;
str = rb_str_new(0, len);
snprintf(RSTRING(str)->ptr, len+1,
- "#<%s:%p@%s:%d>", cname, (VALUE)data->body,
+ "#<%s:0x%lx@%s:%d>", cname, (VALUE)data->body,
node->nd_file, nd_line(node));
}
else {
str = rb_str_new(0, len);
snprintf(RSTRING(str)->ptr, len+1,
- "#<%s:%p>", cname, (VALUE)data->body);
+ "#<%s:0x%lx>", cname, (VALUE)data->body);
}
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
if (OBJ_TAINTED(self)) OBJ_TAINT(str);
@@ -10229,7 +10229,7 @@ rb_thread_deadlock()
char msg[21+SIZEOF_LONG*2];
VALUE e;
- sprintf(msg, "Thread(%p): deadlock", curr_thread->thread);
+ sprintf(msg, "Thread(0x%lx): deadlock", curr_thread->thread);
e = rb_exc_new2(rb_eFatal, msg);
if (curr_thread == main_thread) {
rb_exc_raise(e);
@@ -10509,13 +10509,13 @@ rb_thread_schedule()
TRAP_END;
}
FOREACH_THREAD_FROM(curr, th) {
- warn_printf("deadlock %p: %s:",
+ warn_printf("deadlock 0x%lx: %s:",
th->thread, thread_status_name(th->status));
if (th->wait_for & WAIT_FD) warn_printf("F(%d)", th->fd);
if (th->wait_for & WAIT_SELECT) warn_printf("S");
if (th->wait_for & WAIT_TIME) warn_printf("T(%f)", th->delay);
if (th->wait_for & WAIT_JOIN)
- warn_printf("J(%p)", th->join ? th->join->thread : 0);
+ warn_printf("J(0x%lx)", th->join ? th->join->thread : 0);
if (th->wait_for & WAIT_PID) warn_printf("P");
if (!th->wait_for) warn_printf("-");
warn_printf(" %s - %s:%d\n",
@@ -10752,10 +10752,10 @@ rb_thread_join(th, limit)
if (rb_thread_critical) rb_thread_deadlock();
if (!rb_thread_dead(th)) {
if (th == curr_thread)
- rb_raise(rb_eThreadError, "thread %p tried to join itself",
+ rb_raise(rb_eThreadError, "thread 0x%lx tried to join itself",
th->thread);
if ((th->wait_for & WAIT_JOIN) && th->join == curr_thread)
- rb_raise(rb_eThreadError, "Thread#join: deadlock %p - mutual join(%p)",
+ rb_raise(rb_eThreadError, "Thread#join: deadlock 0x%lx - mutual join(0x%lx)",
curr_thread->thread, th->thread);
if (curr_thread->status == THREAD_TO_KILL)
last_status = THREAD_TO_KILL;
@@ -12269,7 +12269,7 @@ rb_thread_inspect(thread)
size_t len = strlen(cname)+7+16+9+1;
str = rb_str_new(0, len); /* 7:tags 16:addr 9:status 1:nul */
- snprintf(RSTRING(str)->ptr, len, "#<%s:%p %s>", cname, thread, status);
+ snprintf(RSTRING(str)->ptr, len, "#<%s:0x%lx %s>", cname, thread, status);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
OBJ_INFECT(str, thread);
@@ -12803,7 +12803,7 @@ rb_f_throw(argc, argv)
break;
}
if (tt->tag == PROT_THREAD) {
- rb_raise(rb_eThreadError, "uncaught throw `%s' in thread %p",
+ rb_raise(rb_eThreadError, "uncaught throw `%s' in thread 0x%lx",
rb_id2name(SYM2ID(tag)),
curr_thread);
}
diff --git a/gc.c b/gc.c
index 586e9b0..7a2ae7d 100644
--- a/gc.c
+++ b/gc.c
@@ -990,7 +990,7 @@ gc_mark_children(ptr, lev)
break;
default:
- rb_bug("rb_gc_mark(): unknown data type %p(%p) %s",
+ rb_bug("rb_gc_mark(): unknown data type 0x%lx(0x%lx) %s",
obj->as.basic.flags & T_MASK, obj,
is_pointer_to_heap(obj) ? "corrupted object" : "non object");
}
@@ -1256,7 +1256,7 @@ obj_free(obj)
break;
default:
- rb_bug("gc_sweep(): unknown data type %p(%ld)", obj,
+ rb_bug("gc_sweep(): unknown data type 0x%lx(%ld)", obj,
RANY(obj)->as.basic.flags & T_MASK);
}
}
@@ -1883,18 +1883,10 @@ static VALUE
id2ref(obj, id)
VALUE obj, id;
{
-#if SIZEOF_LONG == SIZEOF_VOIDP
-#define NUM2PTR(x) NUM2ULONG(x)
-#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
-#define NUM2PTR(x) NUM2ULL(x)
-#endif
- VALUE ptr;
- void *p0;
+ unsigned long ptr, p0;
rb_secure(4);
- ptr = NUM2PTR(id);
- p0 = (void *)ptr;
-
+ p0 = ptr = NUM2ULONG(id);
if (ptr == Qtrue) return Qtrue;
if (ptr == Qfalse) return Qfalse;
if (ptr == Qnil) return Qnil;
@@ -1905,10 +1897,10 @@ id2ref(obj, id)
ptr = id ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
if (!is_pointer_to_heap((void *)ptr)|| BUILTIN_TYPE(ptr) >= T_BLKTAG) {
- rb_raise(rb_eRangeError, "%p is not id value", p0);
+ rb_raise(rb_eRangeError, "0x%lx is not id value", p0);
}
if (BUILTIN_TYPE(ptr) == 0 || RBASIC(ptr)->klass == 0) {
- rb_raise(rb_eRangeError, "%p is recycled object", p0);
+ rb_raise(rb_eRangeError, "0x%lx is recycled object", p0);
}
return (VALUE)ptr;
}
diff --git a/object.c b/object.c
index 150c69d..b87a1d3 100644
--- a/object.c
+++ b/object.c
@@ -359,7 +359,7 @@ rb_any_to_s(obj)
len = strlen(cname)+6+16;
str = rb_str_new(0, len); /* 6:tags 16:addr */
- snprintf(RSTRING(str)->ptr, len+1, "#<%s:%p>", cname, obj);
+ 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);
@@ -442,13 +442,13 @@ rb_obj_inspect(obj)
if (rb_inspecting_p(obj)) {
len = strlen(c)+10+16+1;
str = rb_str_new(0, len); /* 10:tags 16:addr 1:nul */
- snprintf(RSTRING(str)->ptr, len, "#<%s:%p ...>", c, obj);
+ snprintf(RSTRING(str)->ptr, len, "#<%s:0x%lx ...>", c, obj);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
return str;
}
len = strlen(c)+6+16+1;
str = rb_str_new(0, len); /* 6:tags 16:addr 1:nul */
- snprintf(RSTRING(str)->ptr, len, "-<%s:%p", c, obj);
+ snprintf(RSTRING(str)->ptr, len, "-<%s:0x%lx", c, obj);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
return rb_protect_inspect(inspect_obj, obj, str);
}
diff --git a/ruby.h b/ruby.h
index b613329..1ab4459 100644
--- a/ruby.h
+++ b/ruby.h
@@ -70,14 +70,11 @@ extern "C" {
# define alloca __alloca
#endif
-#if SIZEOF_LONG == SIZEOF_VOIDP
+#if SIZEOF_LONG != SIZEOF_VOIDP
+# error ---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
+#else
typedef unsigned long VALUE;
typedef unsigned long ID;
-#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
-typedef unsigned LONG_LONG VALUE;
-typedef unsigned LONG_LONG ID;
-#else
-# error ---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
#endif
#ifdef __STDC__
diff --git a/sprintf.c b/sprintf.c
index ad24cbd..acfbf64 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -809,10 +809,3 @@ fmt_setup(buf, c, flags, width, prec)
*buf++ = c;
*buf = '\0';
}
-#if SIZEOF_LONG < SIZEOF_VOIDP
-# if SIZEOF_LONG_LONG == SIZEOF_VOIDP
-# define _HAVE_SANE_QUAD_
-# define _HAVE_LLP64_
-# define u_quad_t unsigned LONG_LONG
-# endif
-#endif
diff --git a/variable.c b/variable.c
index 14c5131..34a978f 100644
--- a/variable.c
+++ b/variable.c
@@ -208,7 +208,7 @@ rb_class_path(klass)
}
len = 2 + strlen(s) + 3 + 2 * SIZEOF_LONG + 1;
path = rb_str_new(0, len);
- snprintf(RSTRING(path)->ptr, len+1, "#<%s:%p>", s, klass);
+ snprintf(RSTRING(path)->ptr, len+1, "#<%s:0x%lx>", s, klass);
RSTRING(path)->len = strlen(RSTRING(path)->ptr);
rb_ivar_set(klass, tmp_classpath, path);