summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2023-08-21 17:14:55 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-08-21 17:14:55 +0000
commit73b7da8b812d5796cea88d02f6b4d0b491481239 (patch)
tree46e9c2b11887c5201416f5c97bdeb8307e4aff6a
parent3253074d4265d75944a0ecb990567bad3adc4af0 (diff)
parentb1aec8ff1346e29d6baac39f5364dacd1aaaba8e (diff)
downloadnet-73b7da8b812d5796cea88d02f6b4d0b491481239.tar.gz
Merge "BpfMap - slightly simplify isEmpty()" into main
-rw-r--r--common/native/bpf_headers/include/bpf/BpfMap.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/common/native/bpf_headers/include/bpf/BpfMap.h b/common/native/bpf_headers/include/bpf/BpfMap.h
index 51e6d162..1ddcfe66 100644
--- a/common/native/bpf_headers/include/bpf/BpfMap.h
+++ b/common/native/bpf_headers/include/bpf/BpfMap.h
@@ -235,12 +235,9 @@ class BpfMap {
base::Result<bool> isEmpty() const {
auto key = getFirstKey();
- if (!key.ok()) {
- // Return error code ENOENT means the map is empty
- if (key.error().code() == ENOENT) return true;
- return key.error();
- }
- return false;
+ if (key.ok()) return false;
+ if (key.error().code() == ENOENT) return true;
+ return key.error();
}
private: