mirror of https://github.com/containers/image.git
docker/reference.literal: return QuoteMeta directly
Drop allocs from 4501 to 4413. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
parent
54d770f850
commit
e2cf031b80
|
|
@ -120,13 +120,7 @@ var re = regexp.MustCompile
|
||||||
// literal compiles s into a literal regular expression, escaping any regexp
|
// literal compiles s into a literal regular expression, escaping any regexp
|
||||||
// reserved characters.
|
// reserved characters.
|
||||||
func literal(s string) string {
|
func literal(s string) string {
|
||||||
re := re(regexp.QuoteMeta(s))
|
return regexp.QuoteMeta(s)
|
||||||
|
|
||||||
if _, complete := re.LiteralPrefix(); !complete {
|
|
||||||
panic("must be a literal")
|
|
||||||
}
|
|
||||||
|
|
||||||
return re.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// expression defines a full expression, where each regular expression must
|
// expression defines a full expression, where each regular expression must
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue