commit a0bddc7f4c715688c3cbdc6e1cb03cb5a10aef1a
parent 12e5e25303a3c618eb1f6f6ca0567241360add21
Author: cfillion <cfillion@users.noreply.github.com>
Date: Tue, 1 Mar 2016 19:12:09 -0500
micro optimization: don't use string::find which alawys scan the whole string
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/index.cpp b/src/index.cpp
@@ -21,7 +21,9 @@
#include "errors.hpp"
#include "path.hpp"
+#include <boost/algorithm/string/predicate.hpp>
#include <cerrno>
+
#include <WDL/tinyxml/tinyxml.h>
using namespace std;
@@ -114,7 +116,7 @@ void RemoteIndex::addCategory(const Category *cat)
void RemoteIndex::addLink(const LinkType type, const Link &link)
{
- if(link.url.find("http") == 0)
+ if(boost::algorithm::starts_with(link.url, "http"))
m_links.insert({type, link});
}