diff options
author | David Benjamin <davidben@chromium.org> | 2015-04-09 06:17:55 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-04-11 01:27:10 +0300 |
commit | 48b3150c087bd84f4bdd03c21a1c9a75ca92eec9 (patch) | |
tree | 0e3d6f379c1849b4172484127b554e3fda5b8707 /util | |
parent | e00fc887e41a32b43116ccd7c749025638614b80 (diff) |
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 <agl@google.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/doc.go | 6 |
1 files 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 } |