Skip to content

Commit

Permalink
Grow byte buffer to exact size
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Dec 21, 2024
1 parent a230cb1 commit f23f73c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func (tp *TablePlan) applyChange(rowChange *binlogdatapb.RowChange, executor fun
diff := afterVals[i].RawStr()
beforeVal := bindvars["b_"+field.Name].Value
buf := bytes.Buffer{}
buf.Grow(len(diff) + len(beforeVal) + len(sqlparser.Utf8mb4Str) + 2) // +2 is for the enclosing quotes
buf.Grow(len(beforeVal) + len(sqlparser.Utf8mb4Str) + 2) // +2 is for the enclosing quotes
buf.WriteString(sqlparser.Utf8mb4Str)
buf.WriteByte('\'')
buf.Write(beforeVal)
Expand Down

0 comments on commit f23f73c

Please sign in to comment.