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

ruby-changes:30713

From: usa <ko1@a...>
Date: Tue, 3 Sep 2013 11:02:12 +0900 (JST)
Subject: [ruby-changes:30713] usa:r42792 (trunk): * win32/win32.c (do_select): constify timeout.

usa	2013-09-03 11:02:05 +0900 (Tue, 03 Sep 2013)

  New Revision: 42792

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

  Log:
    * win32/win32.c (do_select): constify timeout.
    
    * win32/win32.c (rb_w32_select_with_thread): constify 10ms wait and
      0ms wait structs.

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42791)
+++ ChangeLog	(revision 42792)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Sep  3 11:00:28 2013  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (do_select): constify timeout.
+
+	* win32/win32.c (rb_w32_select_with_thread): constify 10ms wait and
+	  0ms wait structs.
+
 Tue Sep  3 10:03:42 2013  NAKAMURA Usaku  <usa@r...>
 
 	* test/openssl/test_pair.rb
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 42791)
+++ win32/win32.c	(revision 42792)
@@ -2766,7 +2766,7 @@ is_invalid_handle(SOCKET sock) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L2766
 /* License: Artistic or GPL */
 static int
 do_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
-            struct timeval *timeout)
+	  const struct timeval *timeout)
 {
     int r = 0;
 
@@ -2910,10 +2910,8 @@ rb_w32_select_with_thread(int nfds, fd_s https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L2910
 
     {
 	struct timeval rest;
-	struct timeval wait;
-	struct timeval zero;
-	wait.tv_sec = 0; wait.tv_usec = 10 * 1000; // 10ms
-	zero.tv_sec = 0; zero.tv_usec = 0;         //  0ms
+	const struct timeval wait = {0, 10 * 1000}; // 10ms
+	const struct timeval zero = {0, 0};         // 0ms
 	for (;;) {
 	    if (th && rb_w32_check_interrupt(th) != WAIT_TIMEOUT) {
 		r = -1;
@@ -2936,7 +2934,7 @@ rb_w32_select_with_thread(int nfds, fd_s https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L2934
 		break;
 	    }
 	    else {
-		struct timeval *dowait = &wait;
+		const struct timeval *dowait = &wait;
 
 		fd_set orig_rd;
 		fd_set orig_wr;

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

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