Skip to content

Commit

Permalink
use lazyregexp in a few places
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcacheux committed Jan 16, 2025
1 parent 40d06fd commit 3591a16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/security/seclog/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ package seclog

import (
"fmt"
"regexp"
"runtime"
"strings"
"sync"

"github.com/DataDog/datadog-agent/pkg/util/lazyregexp"
"github.com/DataDog/datadog-agent/pkg/util/log"
)

Expand All @@ -22,7 +22,7 @@ const (
)

// used to extract package.struct.func from the caller
var re = regexp.MustCompile(`[^\.]*\/([^\.]*)\.\(?\*?([^\.\)]*)\)?\.(.*)$`)
var re = lazyregexp.New(`[^\.]*\/([^\.]*)\.\(?\*?([^\.\)]*)\)?\.(.*)$`)

// TagStringer implements fmt.Stringer
type TagStringer struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/security/utils/proc_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (
"os"
"path"
"path/filepath"
"regexp"
"strconv"
"strings"
"sync"

"github.com/DataDog/datadog-agent/pkg/security/secl/model/sharedconsts"
"github.com/DataDog/datadog-agent/pkg/util/kernel"
"github.com/DataDog/datadog-agent/pkg/util/lazyregexp"
"github.com/shirou/gopsutil/v4/process"
)

Expand All @@ -35,7 +35,7 @@ func Getpid() uint32 {
return uint32(os.Getpid())
}

var networkNamespacePattern = regexp.MustCompile(`net:\[(\d+)\]`)
var networkNamespacePattern = lazyregexp.New(`net:\[(\d+)\]`)

// NetNSPath represents a network namespace path
type NetNSPath struct {
Expand Down

0 comments on commit 3591a16

Please sign in to comment.