diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-07-02 17:41:48 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-07-04 15:05:30 +0200 |
| commit | fcb219b67eb296b6781f81074e9cb5b09163f734 (patch) | |
| tree | cb9adbc1e3df32449593f0da45d60fb6c161e07e /pkg/host/syscalls_linux.go | |
| parent | 74cb4e09a50b0f8cc45fce9ac072d1079eb03b42 (diff) | |
all: don't compare string len with 0
For strings it's more readable to compare the string itself with "",
instead of comparing len with 0. Fix all such cases.
Update #1876
Diffstat (limited to 'pkg/host/syscalls_linux.go')
| -rw-r--r-- | pkg/host/syscalls_linux.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/host/syscalls_linux.go b/pkg/host/syscalls_linux.go index 8481d7749..3f16d9ba0 100644 --- a/pkg/host/syscalls_linux.go +++ b/pkg/host/syscalls_linux.go @@ -352,7 +352,7 @@ func isSupportedOpenAt(c *prog.Syscall) (bool, string) { var err error fname, ok := extractStringConst(c.Args[1].Type) - if !ok || len(fname) == 0 || fname[0] != '/' { + if !ok || fname == "" || fname[0] != '/' { return true, "" } @@ -415,7 +415,7 @@ func extractStringConst(typ prog.Type) (string, bool) { return "", false } v := str.Values[0] - for len(v) != 0 && v[len(v)-1] == 0 { + for v != "" && v[len(v)-1] == 0 { v = v[:len(v)-1] // string terminating \x00 } return v, true |
