libbpf_android/Loader.cpp - fix a clang warning (clang-analyzer-deadcode.DeadStores)
//system/bpf/libbpf_android:libbpf_android clang-tidy Loader.cpp
system/bpf/libbpf_android/Loader.cpp:133:5: warning: Value stored to 'entries' is never read [clang-analyzer-deadcode.DeadStores]
entries = shTable.size();
^
system/bpf/libbpf_android/Loader.cpp:133:5: note: Value stored to 'entries' is never read
Test: builds without warnings
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I548976b59d44a51e992c9520e730fc9dae82fce2
diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp
index 8a66c29..43bd1da 100644
--- a/libbpf_android/Loader.cpp
+++ b/libbpf_android/Loader.cpp
@@ -126,11 +126,8 @@
/* Read a section by its index - for ex to get sec hdr strtab blob */
static int readSectionByIdx(ifstream& elfFile, int id, vector<char>& sec) {
vector<Elf64_Shdr> shTable;
- int entries, ret = 0;
-
- ret = readSectionHeadersAll(elfFile, shTable);
+ int ret = readSectionHeadersAll(elfFile, shTable);
if (ret) return ret;
- entries = shTable.size();
elfFile.seekg(shTable[id].sh_offset);
if (elfFile.fail()) return -1;
@@ -144,9 +141,7 @@
/* Read whole section header string table */
static int readSectionHeaderStrtab(ifstream& elfFile, vector<char>& strtab) {
Elf64_Ehdr eh;
- int ret = 0;
-
- ret = readElfHeader(elfFile, &eh);
+ int ret = readElfHeader(elfFile, &eh);
if (ret) return ret;
ret = readSectionByIdx(elfFile, eh.e_shstrndx, strtab);