Skip to content

Commit f8b2801

Browse files
committed
Improve variable name
Make clear than the regexp match an header that repeat each time a new mapped zone start. Also ensure the variable name is prefixed by the filename to avoid conflict with other file. Signed-off-by: Pierre Fersing <[email protected]>
1 parent db6449f commit f8b2801

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

proc_smaps.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import (
2828
)
2929

3030
var (
31-
rFirstLine = regexp.MustCompile(`^[a-f0-9].*$`)
31+
// match the header line before each mapped zone in /proc/pid/smaps
32+
procSMapsHeaderLine = regexp.MustCompile(`^[a-f0-9].*$`)
3233
)
3334

3435
type ProcSMapsRollup struct {
@@ -100,7 +101,7 @@ func (p Proc) procSMapsRollupManual() (ProcSMapsRollup, error) {
100101
for scan.Scan() {
101102
line := scan.Text()
102103

103-
if rFirstLine.MatchString(line) {
104+
if procSMapsHeaderLine.MatchString(line) {
104105
continue
105106
}
106107

0 commit comments

Comments
 (0)