Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 087d76c

Browse files
committed
Code review
Signed-off-by: Theo Despoudis <[email protected]>
1 parent 35beff6 commit 087d76c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sql/expression/function/reverse_repeat_replace.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ func (r *Reverse) Eval(
4444

4545
func reverseString(s string) string {
4646
r := []rune(s)
47-
for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
47+
l := len(r)
48+
l2 := l/2
49+
for i, j := 0, l-1; i < l2; i, j = i+1, j-1 {
4850
r[i], r[j] = r[j], r[i]
4951
}
5052
return string(r)

0 commit comments

Comments
 (0)