aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-09-27 19:19:54 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-09-27 19:19:54 -0400
commitf9cf182edf755856667f7f6ce434a08248d5ea40 (patch)
tree275ad1b25aa99a1d50913e667d06e8ad8afdb861 /gcc
parent1abe4c83cacedf009737748283337eefad1237f4 (diff)
downloadgcc-f9cf182edf755856667f7f6ce434a08248d5ea40.zip
gcc-f9cf182edf755856667f7f6ce434a08248d5ea40.tar.gz
gcc-f9cf182edf755856667f7f6ce434a08248d5ea40.tar.bz2
(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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cccp.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index ea2e2b3..d34d8ed 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';
}