OSDN Git Service

(newline_fix, name_newline_fix): Don't treat \r specially here; it
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Sep 1994 23:19:54 +0000 (23:19 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Sep 1994 23:19:54 +0000 (23:19 +0000)
only causes bugs.  This undoes the May 14 16:01:13 1990 change to
newline_fix and name_newline_fix.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8151 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cccp.c

index ea2e2b3..d34d8ed 100644 (file)
@@ -2310,25 +2310,15 @@ newline_fix (bp)
      U_CHAR *bp;
 {
   register U_CHAR *p = bp;
-  register int count = 0;
 
   /* First count the backslash-newline pairs here.  */
 
-  while (1) {
-    if (p[0] == '\\') {
-      if (p[1] == '\n')
-       p += 2, count++;
-      else if (p[1] == '\r' && p[2] == '\n')
-       p += 3, count++;
-      else
-       break;
-    } else
-      break;
-  }
+  while (p[0] == '\\' && p[1] == '\n')
+    p += 2;
 
   /* What follows the backslash-newlines is not embarrassing.  */
 
-  if (count == 0 || (*p != '/' && *p != '*'))
+  if (*p != '/' && *p != '*')
     return;
 
   /* Copy all potentially embarrassing characters
@@ -2339,7 +2329,7 @@ newline_fix (bp)
     *bp++ = *p++;
 
   /* Now write the same number of pairs after the embarrassing chars.  */
-  while (count-- > 0) {
+  while (bp < p) {
     *bp++ = '\\';
     *bp++ = '\n';
   }
@@ -2353,24 +2343,14 @@ name_newline_fix (bp)
      U_CHAR *bp;
 {
   register U_CHAR *p = bp;
-  register int count = 0;
 
   /* First count the backslash-newline pairs here.  */
-  while (1) {
-    if (p[0] == '\\') {
-      if (p[1] == '\n')
-       p += 2, count++;
-      else if (p[1] == '\r' && p[2] == '\n')
-       p += 3, count++;
-      else
-       break;
-    } else
-      break;
-  }
+  while (p[0] == '\\' && p[1] == '\n')
+    p += 2;
 
   /* What follows the backslash-newlines is not embarrassing.  */
 
-  if (count == 0 || !is_idchar[*p])
+  if (!is_idchar[*p])
     return;
 
   /* Copy all potentially embarrassing characters
@@ -2381,7 +2361,7 @@ name_newline_fix (bp)
     *bp++ = *p++;
 
   /* Now write the same number of pairs after the embarrassing chars.  */
-  while (count-- > 0) {
+  while (bp < p) {
     *bp++ = '\\';
     *bp++ = '\n';
   }