Skip to content

Commit

Permalink
Merge pull request #3829 from ntrel/macro-cr
Browse files Browse the repository at this point in the history
Fix Issue 13212 - Trailing Windows line endings not stripped from .ddoc macros
  • Loading branch information
9rnsr committed Aug 11, 2014
2 parents 5ce80cf + 35735aa commit a3a1ef0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/doc.c
Expand Up @@ -1779,6 +1779,7 @@ void DocComment::parseMacros(Escape **pescapetable, Macro **pmacrotable, const u
p++;
continue;

case '\r':
case '\n':
p++;
goto Lcont;
Expand Down Expand Up @@ -1843,14 +1844,10 @@ void DocComment::parseMacros(Escape **pescapetable, Macro **pmacrotable, const u
textstart = p;

Ltext:
while (p < pend && *p != '\n')
while (p < pend && *p != '\r' && *p != '\n')
p++;
textlen = p - textstart;

// Remove trailing \r if there is one
if (p > m && p[-1] == '\r')
textlen--;

p++;
//printf("p = %p, pend = %p\n", p, pend);

Expand All @@ -1859,8 +1856,8 @@ void DocComment::parseMacros(Escape **pescapetable, Macro **pmacrotable, const u

Lskipline:
// Ignore this line
while (p < pend && *p++ != '\n')
;
while (p < pend && *p != '\r' && *p != '\n')
p++;
}
Ldone:
if (namelen)
Expand Down
4 changes: 3 additions & 1 deletion test/compilable/extra-files/ddoc3.ddoc
@@ -1 +1,3 @@
HELLO = world
HELLO = world

UNUSED=unused

0 comments on commit a3a1ef0

Please sign in to comment.