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

ruby-changes:3337

From: ko1@a...
Date: 1 Jan 2008 22:19:30 +0900
Subject: [ruby-changes:3337] akr - Ruby:r14830 (trunk): abolish warnings by previous change.

akr	2008-01-01 22:19:21 +0900 (Tue, 01 Jan 2008)

  New Revision: 14830

  Modified files:
    trunk/st.c

  Log:
    abolish warnings by previous change.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/st.c?r1=14830&r2=14829&diff_format=u

Index: st.c
===================================================================
--- st.c	(revision 14829)
+++ st.c	(revision 14830)
@@ -869,8 +869,11 @@
     while (1) {
         c1 = (unsigned char)*s1++;
         c2 = (unsigned char)*s2++;
-        if (!c1) break;
-        if (!c2) break;
+        if (c1 == '\0' || c2 == '\0') {
+            if (c1 != '\0') return 1;
+            if (c2 != '\0') return -1;
+            return 0;
+        }
         if ((unsigned int)(c1 - 'A') <= ('Z' - 'A')) c1 += 'a' - 'A';
         if ((unsigned int)(c2 - 'A') <= ('Z' - 'A')) c2 += 'a' - 'A';
         if (c1 != c2) {
@@ -880,11 +883,6 @@
                 return -1;
         }
     }
-    if (c1 != '\0')
-        return 1;
-    if (c2 != '\0')
-        return -1;
-    return 0;
 }
 
 int
@@ -895,8 +893,11 @@
     while (n--) {
         c1 = (unsigned char)*s1++;
         c2 = (unsigned char)*s2++;
-        if (!c1) break;
-        if (!c2) break;
+        if (c1 == '\0' || c2 == '\0') {
+            if (c1 != '\0') return 1;
+            if (c2 != '\0') return -1;
+            return 0;
+        }
         if ((unsigned int)(c1 - 'A') <= ('Z' - 'A')) c1 += 'a' - 'A';
         if ((unsigned int)(c2 - 'A') <= ('Z' - 'A')) c2 += 'a' - 'A';
         if (c1 != c2) {
@@ -906,12 +907,6 @@
                 return -1;
         }
     }
-    if (n == 0)
-        return 0;
-    if (c1 != '\0')
-        return 1;
-    if (c2 != '\0')
-        return -1;
     return 0;
 }
 

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

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