Skip to content

Commit 23e7c0c

Browse files
committed
fix splitting ctag string
1 parent cccb919 commit 23e7c0c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: legacy/builder/ctags/ctags_parser.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,11 @@ func toCompilerCmdLine (define string) string {
263263
// transforms ` A ` to `-DA`
264264
elts := strings.SplitAfterN(define, "=", 2)
265265
ret := ""
266-
if len(elts) > 0 {
267-
ret += "-D"+strings.TrimSpace(elts[0][:len(elts[0])-1])
268-
if len(elts) > 1 {
266+
eltsLength := len(elts)
267+
if eltsLength > 0 {
268+
equalsLength := eltsLength - 1
269+
ret += "-D"+strings.TrimSpace(elts[0][:len(elts[0])-equalsLength])
270+
if equalsLength > 0 {
269271
ret += "="+strings.TrimSpace(elts[1])
270272
}
271273
}

0 commit comments

Comments
 (0)