mirror of https://github.com/jackc/pgx.git
fix preallocations of quoted string
parent
057937db27
commit
120c89fe0d
|
@ -151,7 +151,7 @@ func QuoteString(dst []byte, str string) []byte {
|
||||||
|
|
||||||
dst = append(dst, quote...)
|
dst = append(dst, quote...)
|
||||||
|
|
||||||
p := slices.Grow(dst[len(dst):], len(str)+2*n)
|
p := slices.Grow(dst[len(dst):], 2*len(quote)+len(str)+2*n)
|
||||||
|
|
||||||
for len(str) > 0 {
|
for len(str) > 0 {
|
||||||
i := strings.Index(str, quote)
|
i := strings.Index(str, quote)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package sanitize_test
|
package sanitize_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/jackc/pgx/v5/internal/sanitize"
|
"github.com/jackc/pgx/v5/internal/sanitize"
|
||||||
|
|
Loading…
Reference in New Issue