From: Richard Kenner Date: Tue, 27 Sep 1994 23:19:54 +0000 (-0400) Subject: (newline_fix, name_newline_fix): Don't treat \r specially here; it only causes bugs. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f9cf182edf755856667f7f6ce434a08248d5ea40;p=gcc.git (newline_fix, name_newline_fix): Don't treat \r specially here; it only causes bugs. (newline_fix, name_newline_fix): Don't treat \r specially here; it only causes bugs. This undoes the May 14 16:01:13 1990 change to newline_fix and name_newline_fix. From-SVN: r8151 --- diff --git a/gcc/cccp.c b/gcc/cccp.c index ea2e2b3a9da..d34d8ed87ba 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -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'; }