From 48b3150c087bd84f4bdd03c21a1c9a75ca92eec9 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 8 Apr 2015 23:17:55 -0400 Subject: [PATCH] Fix some parsing bugs in doc.go. skipPast got confused when STACK_OF wasn't in the front of the string (which it rarely was due to OPENSSL_EXPORT). It also couldn't parse comments which end with a '*/' on their own. (Stylistically we don't do this, but ssl_cipher_preference_list_st ends with an ASCII art diagram which probably shouldn't gain a comment marker in the middle.) Change-Id: I7687f4fd126003108906b995da0f2cd53f7d693a Reviewed-on: https://boringssl-review.googlesource.com/4288 Reviewed-by: Adam Langley --- util/doc.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/doc.go b/util/doc.go index 48eac61f..70630367 100644 --- a/util/doc.go +++ b/util/doc.go @@ -111,7 +111,9 @@ func extractComment(lines []string, lineNo int) (comment []string, rest []string err = fmt.Errorf("comment doesn't start with block prefix on line %d: %s", restLineNo, line) return } - line = line[2:] + if len(line) == 2 || line[2] != '/' { + line = line[2:] + } if strings.HasPrefix(line, " ") { /* Identing the lines of a paragraph marks them as * preformatted. */ @@ -193,7 +195,7 @@ func extractDecl(lines []string, lineNo int) (decl string, rest []string, restLi func skipPast(s, skip string) string { i := strings.Index(s, skip) if i > 0 { - return s[len(skip):] + return s[i:] } return s }