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

ruby-changes:27471

From: nobu <ko1@a...>
Date: Wed, 27 Feb 2013 13:47:19 +0900 (JST)
Subject: [ruby-changes:27471] nobu:r39523 (trunk): thread_win32.c: suppress warning

nobu	2013-02-27 13:47:10 +0900 (Wed, 27 Feb 2013)

  New Revision: 39523

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

  Log:
    thread_win32.c: suppress warning
    
    * thread_win32.c (native_sleep): constify local variable to suppress a
      false positive might-be-clobbered warning.

  Modified files:
    trunk/thread_win32.c

Index: thread_win32.c
===================================================================
--- thread_win32.c	(revision 39522)
+++ thread_win32.c	(revision 39523)
@@ -301,14 +301,8 @@ rb_w32_Sleep(unsigned long msec) https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L301
 static void
 native_sleep(rb_thread_t *th, struct timeval *tv)
 {
-    DWORD msec;
-
-    if (tv) {
-	msec = tv->tv_sec * 1000 + tv->tv_usec / 1000;
-    }
-    else {
-	msec = INFINITE;
-    }
+    const DWORD msec = (tv) ?
+	(DWORD)(tv->tv_sec * 1000 + tv->tv_usec / 1000) : INFINITE;
 
     GVL_UNLOCK_BEGIN();
     {

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

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