4

Avoid string copies when looping through cron search dirs by Smjert · Pull Reque...

 2 years ago
source link: https://github.com/osquery/osquery/pull/7331
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Member

Smjert commented on Oct 1, 2021

Fixes a long ignored warning:

/Users/smjert/Development/osquery/src/osquery/tables/system/posix/crontab.cpp:112:19: warning: loop variable 'cron_dir' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Wrange-loop-analysis]
  for (const auto cron_dir : kCronSearchDirs) {
                  ^
/Users/smjert/Development/osquery/src/osquery/tables/system/posix/crontab.cpp:112:8: note: use reference type 'const std::__1::basic_string<char> &' to prevent copying
  for (const auto cron_dir : kCronSearchDirs) {
       ^~~~~~~~~~~~~~~~~~~~~
                  &

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK