tdf#153109 Use std::any_of to simplify loop in sp2bv.cxx
Change-Id: Ib2fd169ba38048ba8a5e886516d91e3bbfbc3bd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203336 Tested-by: Jenkins Reviewed-by: David Gilbert <freedesktop@treblig.org>
This commit is contained in:
committed by
David Gilbert
parent
d66e045a39
commit
3db7176000
@@ -21,6 +21,7 @@
|
||||
#include <osl/thread.h>
|
||||
#include <osl/file.h>
|
||||
#include <rtl/ustrbuf.h>
|
||||
#include <algorithm>
|
||||
|
||||
static bool hasOption(char const * szOption, int argc, char** argv);
|
||||
|
||||
@@ -105,16 +106,7 @@ int main(int argc, char **argv)
|
||||
|
||||
static bool hasOption(char const * szOption, int argc, char** argv)
|
||||
{
|
||||
bool retVal = false;
|
||||
for(int i= 1; i < argc; i++)
|
||||
{
|
||||
if( ! strcmp(argv[i], szOption))
|
||||
{
|
||||
retVal = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
return std::any_of(argv + 1, argv + argc, [szOption](const char* s){ return !strcmp(s, szOption); });
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user