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

ruby-changes:11992

From: nobu <ko1@a...>
Date: Tue, 9 Jun 2009 15:11:24 +0900 (JST)
Subject: [ruby-changes:11992] Ruby:r23656 (trunk): * dir.c (sys_warning): get rid of type-punning function cast.

nobu	2009-06-09 15:11:10 +0900 (Tue, 09 Jun 2009)

  New Revision: 23656

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

  Log:
    * dir.c (sys_warning): get rid of type-punning function cast.
    * dir.c (ruby_glob0): get rid of possible overflow.

  Modified files:
    trunk/ChangeLog
    trunk/dir.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23655)
+++ ChangeLog	(revision 23656)
@@ -1,3 +1,9 @@
+Tue Jun  9 15:11:07 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* dir.c (sys_warning): get rid of type-punning function cast.
+
+	* dir.c (ruby_glob0): get rid of possible overflow.
+
 Tue Jun  9 10:58:48 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* Makefile.in, win32/Makefile.sub (RMALL): need for distclean-rdoc.
Index: dir.c
===================================================================
--- dir.c	(revision 23655)
+++ dir.c	(revision 23656)
@@ -910,15 +910,16 @@
     return INT2FIX(0);
 }
 
-static void
-sys_warning_1(const char* mesg)
+static VALUE
+sys_warning_1(VALUE mesg)
 {
-    rb_sys_warning("%s", mesg);
+    rb_sys_warning("%s", (const char *)mesg);
+    return Qnil;
 }
 
-#define GLOB_VERBOSE	(1UL << (sizeof(int) * CHAR_BIT - 1))
+#define GLOB_VERBOSE	(1U << (sizeof(int) * CHAR_BIT - 1))
 #define sys_warning(val) \
-    (void)((flags & GLOB_VERBOSE) && rb_protect((VALUE (*)(VALUE))sys_warning_1, (VALUE)(val), 0))
+    (void)((flags & GLOB_VERBOSE) && rb_protect(sys_warning_1, (VALUE)(val), 0))
 
 #define GLOB_ALLOC(type) (type *)malloc(sizeof(type))
 #define GLOB_ALLOC_N(type, n) (type *)malloc(sizeof(type) * (n))
@@ -1383,7 +1384,7 @@
     struct glob_pattern *list;
     const char *root, *start;
     char *buf;
-    int n;
+    size_t n;
     int status;
 
     start = root = path;

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

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