summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-08 03:20:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-08 03:20:09 +0000
commitf105a01a3ef5c4d6f9484be1a3779b1358e0f86c (patch)
tree819cf9ed82c084267ecb3b352be082c4a7252b2f
parentaac8fbf09ff2bec1b2a0dfa0b484a422f7cf78da (diff)
* bignum.c (get2comp): calculate proper 2's complement for
negative numbers. a bug in normalizing negative numbers reported from Honda Hiroki <hhonda@ipflex.com>. * ext/socket/socket.c (ruby_getaddrinfo__aix): merged a patch from KUBO Takehiro <kubo@jiubao.org> to support AIX. [ruby-list:40832] * lib/yaml/rubytypes.rb (Array::to_yaml): merged a patch from Tilman Sauerbeck <tilman@code-monkey.de>. [ruby-core:05055] * lib/yaml/rubytypes.rb (Hash::to_yaml): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog18
-rw-r--r--bignum.c10
-rw-r--r--error.c1
-rw-r--r--ext/socket/extconf.rb9
-rw-r--r--ext/socket/socket.c26
-rw-r--r--lib/yaml/rubytypes.rb4
6 files changed, 58 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 677d83b913..1f3cb77317 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Jun 8 11:11:34 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (get2comp): calculate proper 2's complement for
+ negative numbers. a bug in normalizing negative numbers
+ reported from Honda Hiroki <hhonda@ipflex.com>.
+
Wed Jun 8 08:33:10 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enum.c (enum_min_by, enum_max_by): return nil if no iteration.
@@ -7,6 +13,18 @@ Wed Jun 8 08:33:10 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (backtrace): skip successive frames sharing same node.
+Wed Jun 8 00:15:08 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (ruby_getaddrinfo__aix): merged a patch from
+ KUBO Takehiro <kubo@jiubao.org> to support AIX. [ruby-list:40832]
+
+Wed Jun 8 00:09:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/yaml/rubytypes.rb (Array::to_yaml): merged a patch from
+ Tilman Sauerbeck <tilman@code-monkey.de>. [ruby-core:05055]
+
+ * lib/yaml/rubytypes.rb (Hash::to_yaml): ditto.
+
Wed Jun 8 00:00:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/curses/curses.c (curses_insertln): merged a patch from
diff --git a/bignum.c b/bignum.c
index b6cb7b65b4..9272816fc9 100644
--- a/bignum.c
+++ b/bignum.c
@@ -85,7 +85,7 @@ get2comp(x, carry) /* get 2's complement */
if ((ds[RBIGNUM(x)->len-1] & (1<<(BITSPERDIG-1))) == 0) {
REALLOC_N(RBIGNUM(x)->digits, BDIGIT, ++RBIGNUM(x)->len);
ds = BDIGITS(x);
- ds[RBIGNUM(x)->len-1] = ~0;
+ ds[RBIGNUM(x)->len-1] = RBIGNUM(x)->sign ? ~0 : 1;
}
}
@@ -1055,8 +1055,8 @@ rb_big_neg(x)
if (!RBIGNUM(x)->sign) get2comp(z, Qtrue);
while (i--) ds[i] = ~ds[i];
- if (RBIGNUM(x)->sign) get2comp(z, Qfalse);
RBIGNUM(z)->sign = !RBIGNUM(z)->sign;
+ if (RBIGNUM(x)->sign) get2comp(z, Qtrue);
return bignorm(z);
}
@@ -1677,7 +1677,7 @@ rb_big_and(xx, yy)
for (; i<l2; i++) {
zds[i] = sign?0:ds2[i];
}
- if (!RBIGNUM(z)->sign) get2comp(z, Qfalse);
+ if (!RBIGNUM(z)->sign) get2comp(z, Qtrue);
return bignorm(z);
}
@@ -1734,7 +1734,7 @@ rb_big_or(xx, yy)
for (; i<l2; i++) {
zds[i] = sign?ds2[i]:(BIGRAD-1);
}
- if (!RBIGNUM(z)->sign) get2comp(z, Qfalse);
+ if (!RBIGNUM(z)->sign) get2comp(z, Qtrue);
return bignorm(z);
}
@@ -1795,7 +1795,7 @@ rb_big_xor(xx, yy)
for (; i<l2; i++) {
zds[i] = sign?ds2[i]:~ds2[i];
}
- if (!RBIGNUM(z)->sign) get2comp(z, Qfalse);
+ if (!RBIGNUM(z)->sign) get2comp(z, Qtrue);
return bignorm(z);
}
diff --git a/error.c b/error.c
index 1f4a7235f0..f741620ffe 100644
--- a/error.c
+++ b/error.c
@@ -1108,7 +1108,6 @@ void
rb_sys_fail(mesg)
const char *mesg;
{
- extern int errno;
int n = errno;
VALUE arg;
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 66d7462cbf..4c7d32af3b 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -177,8 +177,13 @@ main()
}
for (ai = aitop; ai; ai = ai->ai_next) {
if (ai->ai_family == AF_LOCAL) continue;
- if (ai->ai_addr == NULL ||
- ai->ai_addrlen == 0 ||
+ if (ai->ai_addr == NULL)
+ goto bad;
+#if defined(_AIX)
+ ai->ai_addr->sa_len = ai->ai_addrlen;
+ ai->ai_addr->sa_family = ai->ai_family;
+#endif
+ if (ai->ai_addrlen == 0 ||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
straddr, sizeof(straddr), strport, sizeof(strport),
NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index ae02129cc0..d4edfd5bab 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -173,6 +173,30 @@ ruby_getaddrinfo(nodename, servname, hints, res)
#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo((node),(serv),(hints),(res))
#endif
+#if defined(_AIX)
+static int
+ruby_getaddrinfo__aix(nodename, servname, hints, res)
+ char *nodename;
+ char *servname;
+ struct addrinfo *hints;
+ struct addrinfo **res;
+{
+ int error = getaddrinfo(nodename, servname, hints, res);
+ struct addrinfo *r;
+ if (error)
+ return error;
+ for (r = *res; r != NULL; r = r->ai_next) {
+ if (r->ai_addr->sa_family == 0)
+ r->ai_addr->sa_family = r->ai_family;
+ if (r->ai_addr->sa_len == 0)
+ r->ai_addr->sa_len = r->ai_addrlen;
+ }
+ return 0;
+}
+#undef getaddrinfo
+#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res))
+#endif
+
#ifdef HAVE_CLOSESOCKET
#undef close
#define close closesocket
@@ -2413,7 +2437,9 @@ sock_s_getnameinfo(argc, argv)
* 4th element holds numeric form, don't resolve.
* see ipaddr().
*/
+#ifdef AI_NUMERICHOST /* AIX 4.3.3 doesn't have AI_NUMERICHOST. */
hints.ai_flags |= AI_NUMERICHOST;
+#endif
}
}
else {
diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb
index 2a0c31d990..643b30b22c 100644
--- a/lib/yaml/rubytypes.rb
+++ b/lib/yaml/rubytypes.rb
@@ -77,7 +77,7 @@ hash_proc = Proc.new { |type, val|
elsif Hash === val
type, obj_class = YAML.read_type_class( type, Hash )
if obj_class != Hash
- o = obj_class.new
+ o = obj_class.allocate
o.update( val )
val = o
end
@@ -236,7 +236,7 @@ array_proc = Proc.new { |type, val|
if Array === val
type, obj_class = YAML.read_type_class( type, Array )
if obj_class != Array
- o = obj_class.new
+ o = obj_class.allocate
o.concat( val )
val = o
end