Compile regex on demand not in init

Every podman command is paying the price for this compile even when they
don't use the Regex, this will speed up start of podman by a little.

[NO NEW TESTS NEEDED] Existing tests should catch issues.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2023-01-11 08:56:16 -05:00
parent 1e451031ff
commit 758f20e20a
5 changed files with 96 additions and 70 deletions

View File

@ -3,7 +3,6 @@ package define
import (
"bufio"
"io"
"regexp"
"github.com/containers/common/libnetwork/types"
)
@ -20,8 +19,6 @@ var (
NameRegex = types.NameRegex
// RegexError is thrown in presence of an invalid container/pod name.
RegexError = types.RegexError
// UmaskRegex is a regular expression to validate Umask.
UmaskRegex = regexp.MustCompile(`^[0-7]{1,4}$`)
)
const (