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

ruby-changes:45552

From: nobu <ko1@a...>
Date: Tue, 14 Feb 2017 16:52:37 +0900 (JST)
Subject: [ruby-changes:45552] nobu:r57625 (trunk): initialize variables

nobu	2017-02-14 16:52:30 +0900 (Tue, 14 Feb 2017)

  New Revision: 57625

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57625

  Log:
    initialize variables
    
    * string.c (rb_str_enumerate_lines): initialize conditionally
      used variable.
    
    * thread.c (rb_fd_no_init): ditto.

  Modified files:
    trunk/string.c
    trunk/thread.c
Index: string.c
===================================================================
--- string.c	(revision 57624)
+++ string.c	(revision 57625)
@@ -7493,8 +7493,7 @@ rb_str_enumerate_lines(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/string.c#L7493
     const char *ptr, *pend, *subptr, *subend, *rsptr, *hit, *adjusted;
     long pos, len, rslen;
     int rsnewline = 0;
-
-    VALUE MAYBE_UNUSED(ary);
+    VALUE ary = 0;
 
     if (rb_scan_args(argc, argv, "01:", &rs, &opts) == 0)
 	rs = rb_rs;
@@ -7517,9 +7516,6 @@ rb_str_enumerate_lines(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/string.c#L7516
 	    wantarray = 0;
 #endif
 	}
-#if defined __GNUC__ && !defined __clang__
-	ASSUME(wantarray || !ary); /* if wantarray, ary does not matter */
-#endif
     }
     else {
 	if (wantarray)
Index: thread.c
===================================================================
--- thread.c	(revision 57624)
+++ thread.c	(revision 57625)
@@ -3573,9 +3573,7 @@ rb_fd_select(int n, rb_fdset_t *readfds, https://github.com/ruby/ruby/blob/trunk/thread.c#L3573
     return select(n, r, w, e, timeout);
 }
 
-#if defined __GNUC__ && __GNUC__ >= 5
-# define rb_fd_no_init(fds) ASSUME(!(fds)->fdset && !(fds)->maxfd)
-#endif
+#define rb_fd_no_init(fds) (((fds)->fdset = 0), ((fds)->maxfd = 0))
 
 #undef FD_ZERO
 #undef FD_SET
@@ -3640,9 +3638,7 @@ rb_fd_set(int fd, rb_fdset_t *set) https://github.com/ruby/ruby/blob/trunk/thread.c#L3638
 #define FD_CLR(i, f)	rb_fd_clr((i), (f))
 #define FD_ISSET(i, f)	rb_fd_isset((i), (f))
 
-#if defined __GNUC__ && __GNUC__ >= 5
-# define rb_fd_no_init(fds) ASSUME(!(fds)->fdset)
-#endif
+#define rb_fd_no_init(fds) ((fds)->fdset = 0)
 
 #endif
 

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

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