[前][次][番号順一覧][スレッド一覧]

ruby-changes:10699

From: nobu <ko1@a...>
Date: Thu, 12 Feb 2009 23:29:04 +0900 (JST)
Subject: [ruby-changes:10699] Ruby:r22262 (trunk): * gc.c (vm_xmalloc, vm_xrealloc): comparisons had no meanings on

nobu	2009-02-12 23:28:58 +0900 (Thu, 12 Feb 2009)

  New Revision: 22262

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22262

  Log:
    * gc.c (vm_xmalloc, vm_xrealloc): comparisons had no meanings on
      platforms where size_t is unsigned.

  Modified files:
    trunk/gc.c

Index: gc.c
===================================================================
--- gc.c	(revision 22261)
+++ gc.c	(revision 22262)
@@ -608,7 +608,7 @@
 {
     void *mem;
 
-    if (size < 0) {
+    if ((ssize_t)size < 0) {
 	negative_size_allocation_error("negative allocation size (or too big)");
     }
     if (size == 0) size = 1;
@@ -647,7 +647,7 @@
 {
     void *mem;
 
-    if (size < 0) {
+    if ((ssize_t)size < 0) {
 	negative_size_allocation_error("negative re-allocation size");
     }
     if (!ptr) return ruby_xmalloc(size);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]