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

ruby-changes:40072

From: nobu <ko1@a...>
Date: Sun, 18 Oct 2015 08:38:24 +0900 (JST)
Subject: [ruby-changes:40072] nobu:r52153 (trunk): ruby.c: suppress warnings

nobu	2015-10-18 08:38:18 +0900 (Sun, 18 Oct 2015)

  New Revision: 52153

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

  Log:
    ruby.c: suppress warnings
    
    * ruby.c (loadopen_func): suppress a warning, unused function.
    
    * ruby.c (open_load_file): suppress warnings, results of close(2).

  Modified files:
    trunk/ruby.c
Index: ruby.c
===================================================================
--- ruby.c	(revision 52152)
+++ ruby.c	(revision 52153)
@@ -1726,6 +1726,7 @@ load_file_internal(VALUE argp_v) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1726
     return (VALUE)tree;
 }
 
+#ifdef S_ISFIFO
 static void *
 loadopen_func(void *arg)
 {
@@ -1736,6 +1737,7 @@ loadopen_func(void *arg) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1737
 
     return (void *)(VALUE)fd;
 }
+#endif
 
 static VALUE
 open_load_file(VALUE fname_v, int *xflag)
@@ -1777,7 +1779,7 @@ open_load_file(VALUE fname_v, int *xflag https://github.com/ruby/ruby/blob/trunk/ruby.c#L1779
 	/* disabling O_NONBLOCK */
 	if (fcntl(fd, F_SETFL, 0) < 0) {
 	    e = errno;
-	    close(fd);
+	    (void)close(fd);
 	    rb_load_fail(fname_v, strerror(e));
 	}
 #endif
@@ -1787,12 +1789,12 @@ open_load_file(VALUE fname_v, int *xflag https://github.com/ruby/ruby/blob/trunk/ruby.c#L1789
 	    struct stat st;
 	    if (fstat(fd, &st) != 0) {
 		e = errno;
-		close(fd);
+		(void)close(fd);
 		rb_load_fail(fname_v, strerror(e));
 	    }
 	    if (S_ISFIFO(st.st_mode)) {
 		/* We need to wait if FIFO is empty. So, let's reopen it. */
-		close(fd);
+		(void)close(fd);
 		fd = (int)(VALUE)rb_thread_call_without_gvl(loadopen_func,
 						(void *)fname, RUBY_UBF_IO, 0);
 		if (fd < 0)
@@ -1801,7 +1803,7 @@ open_load_file(VALUE fname_v, int *xflag https://github.com/ruby/ruby/blob/trunk/ruby.c#L1803
 	}
 #endif
 	if (!ruby_is_fd_loadable(fd)) {
-	    close(fd);
+	    (void)close(fd);
 	    rb_load_fail(fname_v, strerror(errno));
 	}
 

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

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