libbpf_android/Loader.cpp - fixes performance-inefficient-string-concatenation warning

Fixes:
  system/bpf/libbpf_android/Loader.cpp:562:73: warning: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation]
          string progPinLoc = string(BPF_FS_PATH) + "prog_" + fname + "_" + name;
                                                                          ^

Test: builds
Bug: 153035880
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If56405273b4904e632a4b3a465b79eecae4c1446
This commit is contained in:
Maciej Żenczykowski 2020-04-23 12:46:00 -07:00
commit 6c7871b8df

View file

@ -559,7 +559,10 @@ static int loadCodeSections(const char* elfPath, vector<codeSection>& cs, const
bool reuse = false;
// Format of pin location is
// /sys/fs/bpf/prog_<filename>_<mapname>
string progPinLoc = string(BPF_FS_PATH) + "prog_" + fname + "_" + name;
string progPinLoc = BPF_FS_PATH "prog_";
progPinLoc += fname;
progPinLoc += '_';
progPinLoc += name;
if (access(progPinLoc.c_str(), F_OK) == 0) {
fd = bpf_obj_get(progPinLoc.c_str());
ALOGD("New bpf prog load reusing prog %s, ret: %d\n", progPinLoc.c_str(), fd);