summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1994-04-21 21:18:04 +0000
committerRoland McGrath <roland@redhat.com>1994-04-21 21:18:04 +0000
commit117d4e0f367ebe2423ef7bbbacd3a1b53c76a936 (patch)
treef8409075262295f9ec68c6167f084f8ef94c5398
parent9b0a99a051fbf92dd37784271ec211dd11dd5a98 (diff)
downloadmake-117d4e0f367ebe2423ef7bbbacd3a1b53c76a936.tar.gz
(remove_comments): Use find_char_unquote.
-rw-r--r--misc.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/misc.c b/misc.c
index 5a8327d..8c281f3 100644
--- a/misc.c
+++ b/misc.c
@@ -124,36 +124,13 @@ void
remove_comments (line)
char *line;
{
- register char *p, *p2;
- register int backslash;
- register unsigned int bs_write;
+ char *comment;
- while (1)
- {
- p = index (line, '#');
- if (p == 0)
- break;
+ comment = find_char_unquote (line, '#', 0);
- backslash = 0;
- bs_write = 0;
- for (p2 = p - 1; p2 >= line && *p2 == '\\'; --p2)
- {
- if (backslash)
- ++bs_write;
- backslash = !backslash;
- }
-
- if (!backslash)
- {
- /* Cut off the line at the #. */
- *p = '\0';
- break;
- }
-
- /* strcpy better copy left to right. */
- line = p;
- strcpy (p2 + 1 + bs_write, line);
- }
+ if (comment != 0)
+ /* Cut off the line at the #. */
+ *comment = '\0';
}
/* Print N spaces (used by DEBUGPR for target-depth). */