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

ruby-changes:38265

From: nobu <ko1@a...>
Date: Sun, 19 Apr 2015 12:19:40 +0900 (JST)
Subject: [ruby-changes:38265] nobu:r50346 (trunk): ext: suppress warnings

nobu	2015-04-19 12:19:20 +0900 (Sun, 19 Apr 2015)

  New Revision: 50346

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

  Log:
    ext: suppress warnings
    
    * ext/{etc,openssl,tk}: Adding parens and comparisons around
      assignments to get rid of Wparentheses warnings.  [Fix GH-875]

  Modified files:
    trunk/ChangeLog
    trunk/ext/etc/etc.c
    trunk/ext/openssl/ossl_ssl.c
    trunk/ext/tk/tkutil/tkutil.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50345)
+++ ChangeLog	(revision 50346)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Apr 19 12:19:17 2015  Chad Brewbaker  <crb002@g...>
+
+	* ext/{etc,openssl,tk}: Adding parens and comparisons around
+	  assignments to get rid of Wparentheses warnings.  [Fix GH-875]
+
 Sun Apr 19 10:42:54 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* hash.c (get_env_cstr): environment variables must be ASCII
Index: ext/tk/tkutil/tkutil.c
===================================================================
--- ext/tk/tkutil/tkutil.c	(revision 50345)
+++ ext/tk/tkutil/tkutil.c	(revision 50346)
@@ -1356,7 +1356,7 @@ cbsubst_sym_to_subst(self, sym) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L1356
 
     *(ptr++) = '%';
 
-    if (len = inf->keylen[idx]) {
+    if ((len = inf->keylen[idx]) != 0) {
       /* longname */
       strncpy(ptr, inf->key[idx], len);
       ptr += len;
@@ -1426,7 +1426,7 @@ cbsubst_get_subst_arg(argc, argv, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L1426
 
 	*(ptr++) = '%';
 
-	if (len = inf->keylen[idx]) {
+	if ((len = inf->keylen[idx]) != 0) {
 	  /* longname */
 	  strncpy(ptr, inf->key[idx], len);
 	  ptr += len;
@@ -1523,7 +1523,7 @@ cbsubst_get_all_subst_keys(self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L1523
 
       *(ptr++) = '%';
 
-      if (len = inf->keylen[idx]) {
+      if ((len = inf->keylen[idx]) != 0) {
 	/* longname */
 	strncpy(ptr, inf->key[idx], len);
 	ptr += len;
@@ -1691,7 +1691,7 @@ cbsubst_scan_args(self, arg_key, val_ary https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L1691
       } else if (*(keyptr + idx) == ' ') {
 	proc = Qnil;
       } else {
-	if (type_chr = inf->type[*(keyptr + idx)]) {
+	if ((type_chr = inf->type[*(keyptr + idx)]) != 0) {
 	  proc = rb_hash_aref(inf->proc, INT2FIX((int)type_chr));
 	} else {
 	  proc = Qnil;
Index: ext/openssl/ossl_ssl.c
===================================================================
--- ext/openssl/ossl_ssl.c	(revision 50345)
+++ ext/openssl/ossl_ssl.c	(revision 50346)
@@ -1124,7 +1124,7 @@ ossl_ssl_shutdown(SSL *ssl) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1124
 	     * Ignore the case SSL_shutdown returns -1. Empty handshake_func
 	     * must not happen.
 	     */
-	    if (rc = SSL_shutdown(ssl))
+	    if ((rc = SSL_shutdown(ssl)) != 0)
 		break;
 	}
 	SSL_clear(ssl);
Index: ext/etc/etc.c
===================================================================
--- ext/etc/etc.c	(revision 50345)
+++ ext/etc/etc.c	(revision 50346)
@@ -241,7 +241,7 @@ passwd_iterate(void) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L241
     struct passwd *pw;
 
     setpwent();
-    while (pw = getpwent()) {
+    while ((pw = getpwent()) != 0) {
 	rb_yield(setup_passwd(pw));
     }
     return Qnil;
@@ -287,7 +287,7 @@ etc_passwd(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L287
     if (rb_block_given_p()) {
 	each_passwd();
     }
-    else if (pw = getpwent()) {
+    else if ((pw = getpwent()) != 0) {
 	return setup_passwd(pw);
     }
 #endif
@@ -369,7 +369,7 @@ etc_getpwent(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L369
 #ifdef HAVE_GETPWENT
     struct passwd *pw;
 
-    if (pw = getpwent()) {
+    if ((pw = getpwent()) != 0) {
 	return setup_passwd(pw);
     }
 #endif
@@ -485,7 +485,7 @@ group_iterate(void) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L485
     struct group *pw;
 
     setgrent();
-    while (pw = getgrent()) {
+    while ((pw = getgrent()) != 0) {
 	rb_yield(setup_group(pw));
     }
     return Qnil;
@@ -527,7 +527,7 @@ etc_group(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L527
     if (rb_block_given_p()) {
 	each_group();
     }
-    else if (grp = getgrent()) {
+    else if ((grp = getgrent()) != 0) {
 	return setup_group(grp);
     }
 #endif
@@ -606,7 +606,7 @@ etc_getgrent(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L606
 #ifdef HAVE_GETGRENT
     struct group *gr;
 
-    if (gr = getgrent()) {
+    if ((gr = getgrent()) != 0) {
 	return setup_group(gr);
     }
 #endif

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

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