aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-01-04 21:35:24 +0100
committerDaniel Neus <[email protected]>2016-01-04 21:35:24 +0100
commit443a5c25db02aa7ac505fdc3b0fa60c1d584a5f1 (patch)
tree6683223da4ea9917914c0eb9d7d1110cc86ac6f6
parent9d3ad9a0f44a9321185ed9f221c828dac81b9f0c (diff)
String comparision fixes
fix PVS-Studio perfomance warnings
-rw-r--r--src/cli/bench.cpp2
-rw-r--r--src/lib/asn1/asn1_alt_name.cpp4
-rw-r--r--src/lib/asn1/asn1_oid.cpp2
-rw-r--r--src/lib/asn1/oid_lookup/oids.cpp4
-rw-r--r--src/lib/asn1/x509_dn.cpp2
-rw-r--r--src/lib/base/algo_registry.h2
-rw-r--r--src/lib/cert/x509/certstor.cpp2
-rw-r--r--src/lib/cert/x509/ocsp.cpp2
-rw-r--r--src/lib/cert/x509/x509_ext.cpp2
-rw-r--r--src/lib/cert/x509/x509_ext.h2
-rw-r--r--src/lib/cert/x509/x509cert.cpp6
-rw-r--r--src/lib/cert/x509/x509opt.cpp4
-rw-r--r--src/lib/cert/x509/x509path.cpp2
-rw-r--r--src/lib/cert/x509/x509self.cpp2
-rw-r--r--src/lib/misc/openpgp/openpgp.cpp2
-rw-r--r--src/lib/pubkey/pkcs8.cpp6
-rw-r--r--src/lib/pubkey/pubkey.cpp2
-rw-r--r--src/lib/tls/msg_cert_req.cpp2
-rw-r--r--src/lib/tls/msg_cert_verify.cpp2
-rw-r--r--src/lib/tls/msg_server_hello.cpp4
-rw-r--r--src/lib/tls/tls_ciphersuite.h2
-rw-r--r--src/lib/tls/tls_extensions.cpp4
-rw-r--r--src/lib/tls/tls_extensions.h4
-rw-r--r--src/lib/tls/tls_handshake_state.cpp4
-rw-r--r--src/lib/tls/tls_policy.h6
-rw-r--r--src/lib/utils/http_util/http_util.cpp4
-rw-r--r--src/lib/utils/parsing.cpp14
-rw-r--r--src/lib/utils/read_cfg.cpp4
-rw-r--r--src/tests/tests.cpp4
29 files changed, 51 insertions, 51 deletions
diff --git a/src/cli/bench.cpp b/src/cli/bench.cpp
index cd16a291f..44668f1d3 100644
--- a/src/cli/bench.cpp
+++ b/src/cli/bench.cpp
@@ -353,7 +353,7 @@ class Benchmark : public Command
{
for(auto&& prov : T::providers(algo))
{
- if(provider == "" || provider == prov)
+ if(provider.empty() || provider == prov)
{
auto p = T::create(algo, prov);
diff --git a/src/lib/asn1/asn1_alt_name.cpp b/src/lib/asn1/asn1_alt_name.cpp
index 9e59321f7..131152521 100644
--- a/src/lib/asn1/asn1_alt_name.cpp
+++ b/src/lib/asn1/asn1_alt_name.cpp
@@ -55,7 +55,7 @@ AlternativeName::AlternativeName(const std::string& email_addr,
void AlternativeName::add_attribute(const std::string& type,
const std::string& str)
{
- if(type == "" || str == "")
+ if(type.empty() || str.empty())
return;
auto range = alt_info.equal_range(type);
@@ -72,7 +72,7 @@ void AlternativeName::add_attribute(const std::string& type,
void AlternativeName::add_othername(const OID& oid, const std::string& value,
ASN1_Tag type)
{
- if(value == "")
+ if(value.empty())
return;
multimap_insert(othernames, oid, ASN1_String(value, type));
}
diff --git a/src/lib/asn1/asn1_oid.cpp b/src/lib/asn1/asn1_oid.cpp
index 2fbc4b27c..3232d24e6 100644
--- a/src/lib/asn1/asn1_oid.cpp
+++ b/src/lib/asn1/asn1_oid.cpp
@@ -18,7 +18,7 @@ namespace Botan {
*/
OID::OID(const std::string& oid_str)
{
- if(oid_str != "")
+ if(!oid_str.empty())
{
try
{
diff --git a/src/lib/asn1/oid_lookup/oids.cpp b/src/lib/asn1/oid_lookup/oids.cpp
index 8ce0ec644..0d1ab58ff 100644
--- a/src/lib/asn1/oid_lookup/oids.cpp
+++ b/src/lib/asn1/oid_lookup/oids.cpp
@@ -109,12 +109,12 @@ void OID_Map::read_cfg(std::istream& cfg, const std::string& source)
std::getline(cfg, s);
++line;
- if(s == "" || s[0] == '#')
+ if(s.empty() || s[0] == '#')
continue;
s = clean_ws(s.substr(0, s.find('#')));
- if(s == "")
+ if(s.empty())
continue;
auto eq = s.find("=");
diff --git a/src/lib/asn1/x509_dn.cpp b/src/lib/asn1/x509_dn.cpp
index ff4a73ebb..80bbe81a3 100644
--- a/src/lib/asn1/x509_dn.cpp
+++ b/src/lib/asn1/x509_dn.cpp
@@ -55,7 +55,7 @@ void X509_DN::add_attribute(const std::string& type,
*/
void X509_DN::add_attribute(const OID& oid, const std::string& str)
{
- if(str == "")
+ if(str.empty())
return;
auto range = dn_info.equal_range(oid);
diff --git a/src/lib/base/algo_registry.h b/src/lib/base/algo_registry.h
index a431e9178..4265b737d 100644
--- a/src/lib/base/algo_registry.h
+++ b/src/lib/base/algo_registry.h
@@ -186,7 +186,7 @@ class Algo_Registry
{
std::vector<maker_fn> r;
- if(req_provider != "")
+ if(!req_provider.empty())
{
// find one explicit provider requested by user or fail
auto i = m_maker_fns.find(req_provider);
diff --git a/src/lib/cert/x509/certstor.cpp b/src/lib/cert/x509/certstor.cpp
index e3498f602..26c9ce117 100644
--- a/src/lib/cert/x509/certstor.cpp
+++ b/src/lib/cert/x509/certstor.cpp
@@ -115,7 +115,7 @@ Certificate_Store_In_Memory::Certificate_Store_In_Memory(const X509_Certificate&
Certificate_Store_In_Memory::Certificate_Store_In_Memory(const std::string& dir)
{
- if(dir == "")
+ if(dir.empty())
return;
std::vector<std::string> maybe_certs = get_files_recursive(dir);
diff --git a/src/lib/cert/x509/ocsp.cpp b/src/lib/cert/x509/ocsp.cpp
index 75475fe55..4f4a3aece 100644
--- a/src/lib/cert/x509/ocsp.cpp
+++ b/src/lib/cert/x509/ocsp.cpp
@@ -228,7 +228,7 @@ Response online_check(const X509_Certificate& issuer,
{
const std::string responder_url = subject.ocsp_responder();
- if(responder_url == "")
+ if(responder_url.empty())
throw Exception("No OCSP responder specified");
OCSP::Request req(issuer, subject);
diff --git a/src/lib/cert/x509/x509_ext.cpp b/src/lib/cert/x509/x509_ext.cpp
index f752500c0..a05d27d3e 100644
--- a/src/lib/cert/x509/x509_ext.cpp
+++ b/src/lib/cert/x509/x509_ext.cpp
@@ -549,7 +549,7 @@ void Authority_Information_Access::decode_inner(const std::vector<byte>& in)
void Authority_Information_Access::contents_to(Data_Store& subject, Data_Store&) const
{
- if(m_ocsp_responder != "")
+ if(!m_ocsp_responder.empty())
subject.add("OCSP.responder", m_ocsp_responder);
}
diff --git a/src/lib/cert/x509/x509_ext.h b/src/lib/cert/x509/x509_ext.h
index 2ed892055..0ce49231a 100644
--- a/src/lib/cert/x509/x509_ext.h
+++ b/src/lib/cert/x509/x509_ext.h
@@ -295,7 +295,7 @@ class BOTAN_DLL Authority_Information_Access : public Certificate_Extension
std::string oid_name() const override
{ return "PKIX.AuthorityInformationAccess"; }
- bool should_encode() const override { return (m_ocsp_responder != ""); }
+ bool should_encode() const override { return (!m_ocsp_responder.empty()); }
std::vector<byte> encode_inner() const override;
void decode_inner(const std::vector<byte>&) override;
diff --git a/src/lib/cert/x509/x509cert.cpp b/src/lib/cert/x509/x509cert.cpp
index 3d1ebbbad..7e5199c00 100644
--- a/src/lib/cert/x509/x509cert.cpp
+++ b/src/lib/cert/x509/x509cert.cpp
@@ -379,7 +379,7 @@ std::string X509_Certificate::fingerprint(const std::string& hash_name) const
bool X509_Certificate::matches_dns_name(const std::string& name) const
{
- if(name == "")
+ if(name.empty())
return false;
std::vector<std::string> issued_names = subject_info("DNS");
@@ -508,9 +508,9 @@ std::string X509_Certificate::to_string() const
out << " " << ex_constraints[i] << "\n";
}
- if(ocsp_responder() != "")
+ if(!ocsp_responder().empty())
out << "OCSP responder " << ocsp_responder() << "\n";
- if(crl_distribution_point() != "")
+ if(!crl_distribution_point().empty())
out << "CRL " << crl_distribution_point() << "\n";
out << "Signature algorithm: " <<
diff --git a/src/lib/cert/x509/x509opt.cpp b/src/lib/cert/x509/x509opt.cpp
index 52845658f..158f4c779 100644
--- a/src/lib/cert/x509/x509opt.cpp
+++ b/src/lib/cert/x509/x509opt.cpp
@@ -66,7 +66,7 @@ void X509_Cert_Options::CA_key(size_t limit)
*/
void X509_Cert_Options::sanity_check() const
{
- if(common_name == "" || country == "")
+ if(common_name.empty() || country.empty())
throw Encoding_Error("X.509 certificate: name and country MUST be set");
if(country.size() != 2)
throw Encoding_Error("Invalid ISO country code: " + country);
@@ -89,7 +89,7 @@ X509_Cert_Options::X509_Cert_Options(const std::string& initial_opts,
start = X509_Time(now);
end = X509_Time(now + std::chrono::seconds(expiration_time));
- if(initial_opts == "")
+ if(initial_opts.empty())
return;
std::vector<std::string> parsed = split_on(initial_opts, '/');
diff --git a/src/lib/cert/x509/x509path.cpp b/src/lib/cert/x509/x509path.cpp
index 5e12ddb2a..71c025280 100644
--- a/src/lib/cert/x509/x509path.cpp
+++ b/src/lib/cert/x509/x509path.cpp
@@ -249,7 +249,7 @@ Path_Validation_Result x509_path_validate(
std::vector<std::set<Certificate_Status_Code>> res = check_chain(cert_path, restrictions, certstores);
- if(hostname != "" && !cert_path[0].matches_dns_name(hostname))
+ if(!hostname.empty() && !cert_path[0].matches_dns_name(hostname))
res[0].insert(Certificate_Status_Code::CERT_NAME_NOMATCH);
if(!cert_path[0].allowed_usage(usage))
diff --git a/src/lib/cert/x509/x509self.cpp b/src/lib/cert/x509/x509self.cpp
index 2f2f6a59f..7d1c01c37 100644
--- a/src/lib/cert/x509/x509self.cpp
+++ b/src/lib/cert/x509/x509self.cpp
@@ -126,7 +126,7 @@ PKCS10_Request create_cert_req(const X509_Cert_Options& opts,
.raw_bytes(pub_key)
.start_explicit(0);
- if(opts.challenge != "")
+ if(!opts.challenge.empty())
{
ASN1_String challenge(opts.challenge, DIRECTORY_STRING);
diff --git a/src/lib/misc/openpgp/openpgp.cpp b/src/lib/misc/openpgp/openpgp.cpp
index f42ce875e..7a08a93ef 100644
--- a/src/lib/misc/openpgp/openpgp.cpp
+++ b/src/lib/misc/openpgp/openpgp.cpp
@@ -177,7 +177,7 @@ secure_vector<byte> PGP_decode(DataSource& source,
}
base64.end_msg();
- if(crc != "" && crc != base64.read_all_as_string(1))
+ if(!crc.empty() && crc != base64.read_all_as_string(1))
throw Decoding_Error("PGP: Corrupt CRC");
return base64.read_all();
diff --git a/src/lib/pubkey/pkcs8.cpp b/src/lib/pubkey/pkcs8.cpp
index 1a021a283..ddf9be2f0 100644
--- a/src/lib/pubkey/pkcs8.cpp
+++ b/src/lib/pubkey/pkcs8.cpp
@@ -153,7 +153,7 @@ namespace {
std::pair<std::string, std::string>
choose_pbe_params(const std::string& pbe_algo, const std::string& key_algo)
{
- if(pbe_algo == "")
+ if(pbe_algo.empty())
{
// Defaults:
if(key_algo == "Curve25519" || key_algo == "McEliece")
@@ -202,7 +202,7 @@ std::string PEM_encode(const Private_Key& key,
std::chrono::milliseconds msec,
const std::string& pbe_algo)
{
- if(pass == "")
+ if(pass.empty())
return PEM_encode(key);
return PEM_Code::encode(PKCS8::BER_encode(key, rng, pass, msec, pbe_algo),
@@ -223,7 +223,7 @@ Private_Key* load_key(DataSource& source,
secure_vector<byte> pkcs8_key = PKCS8_decode(source, get_pass, alg_id, is_encrypted);
const std::string alg_name = OIDS::lookup(alg_id.oid);
- if(alg_name == "" || alg_name == alg_id.oid.as_string())
+ if(alg_name.empty() || alg_name == alg_id.oid.as_string())
throw PKCS8_Exception("Unknown algorithm OID: " +
alg_id.oid.as_string());
diff --git a/src/lib/pubkey/pubkey.cpp b/src/lib/pubkey/pubkey.cpp
index 3d09e44d5..37408272a 100644
--- a/src/lib/pubkey/pubkey.cpp
+++ b/src/lib/pubkey/pubkey.cpp
@@ -22,7 +22,7 @@ T* get_pk_op(const std::string& what, const Key& key, const std::string& pad,
return p;
const std::string err = what + " with " + key.algo_name() + "/" + pad + " not supported";
- if(provider != "")
+ if(!provider.empty())
throw Lookup_Error(err + " with provider " + provider);
else
throw Lookup_Error(err);
diff --git a/src/lib/tls/msg_cert_req.cpp b/src/lib/tls/msg_cert_req.cpp
index aaaf754c8..4fd528148 100644
--- a/src/lib/tls/msg_cert_req.cpp
+++ b/src/lib/tls/msg_cert_req.cpp
@@ -89,7 +89,7 @@ Certificate_Req::Certificate_Req(const std::vector<byte>& buf,
{
const std::string cert_type_name = cert_type_code_to_name(cert_type_codes[i]);
- if(cert_type_name == "") // something we don't know
+ if(cert_type_name.empty()) // something we don't know
continue;
m_cert_key_types.push_back(cert_type_name);
diff --git a/src/lib/tls/msg_cert_verify.cpp b/src/lib/tls/msg_cert_verify.cpp
index 74565e29b..be6c8a069 100644
--- a/src/lib/tls/msg_cert_verify.cpp
+++ b/src/lib/tls/msg_cert_verify.cpp
@@ -59,7 +59,7 @@ std::vector<byte> Certificate_Verify::serialize() const
{
std::vector<byte> buf;
- if(m_hash_algo != "" && m_sig_algo != "")
+ if(!m_hash_algo.empty() && !m_sig_algo.empty())
{
buf.push_back(Signature_Algorithms::hash_algo_code(m_hash_algo));
buf.push_back(Signature_Algorithms::sig_algo_code(m_sig_algo));
diff --git a/src/lib/tls/msg_server_hello.cpp b/src/lib/tls/msg_server_hello.cpp
index 25d53b81b..8d61fb23c 100644
--- a/src/lib/tls/msg_server_hello.cpp
+++ b/src/lib/tls/msg_server_hello.cpp
@@ -50,7 +50,7 @@ Server_Hello::Server_Hello(Handshake_IO& io,
if(policy.negotiate_heartbeat_support() && client_hello.supports_heartbeats())
m_extensions.add(new Heartbeat_Support_Indicator(true));
- if(next_protocol != "" && client_hello.supports_alpn())
+ if(!next_protocol.empty() && client_hello.supports_alpn())
m_extensions.add(new Application_Layer_Protocol_Notification(next_protocol));
if(m_version.is_datagram_protocol())
@@ -108,7 +108,7 @@ Server_Hello::Server_Hello(Handshake_IO& io,
if(policy.negotiate_heartbeat_support() && client_hello.supports_heartbeats())
m_extensions.add(new Heartbeat_Support_Indicator(true));
- if(next_protocol != "" && client_hello.supports_alpn())
+ if(!next_protocol.empty() && client_hello.supports_alpn())
m_extensions.add(new Application_Layer_Protocol_Notification(next_protocol));
hash.update(io.send(*this));
diff --git a/src/lib/tls/tls_ciphersuite.h b/src/lib/tls/tls_ciphersuite.h
index 26faca11b..6dcf3dcc2 100644
--- a/src/lib/tls/tls_ciphersuite.h
+++ b/src/lib/tls/tls_ciphersuite.h
@@ -91,7 +91,7 @@ class BOTAN_DLL Ciphersuite
const std::string& prf_algo() const
{
- return (m_prf_algo != "") ? m_prf_algo : m_mac_algo;
+ return (!m_prf_algo.empty()) ? m_prf_algo : m_mac_algo;
}
/**
diff --git a/src/lib/tls/tls_extensions.cpp b/src/lib/tls/tls_extensions.cpp
index cedf390e6..3ca5be671 100644
--- a/src/lib/tls/tls_extensions.cpp
+++ b/src/lib/tls/tls_extensions.cpp
@@ -427,7 +427,7 @@ Supported_Elliptic_Curves::Supported_Elliptic_Curves(TLS_Data_Reader& reader,
const u16bit id = reader.get_u16bit();
const std::string name = curve_id_to_name(id);
- if(name != "")
+ if(!name.empty())
m_curves.push_back(name);
}
}
@@ -555,7 +555,7 @@ Signature_Algorithms::Signature_Algorithms(TLS_Data_Reader& reader,
len -= 2;
// If not something we know, ignore it completely
- if(hash_code == "" || sig_code == "")
+ if(hash_code.empty() || sig_code.empty())
continue;
m_supported_algos.push_back(std::make_pair(hash_code, sig_code));
diff --git a/src/lib/tls/tls_extensions.h b/src/lib/tls/tls_extensions.h
index d7d8ab380..8c28fab31 100644
--- a/src/lib/tls/tls_extensions.h
+++ b/src/lib/tls/tls_extensions.h
@@ -89,7 +89,7 @@ class Server_Name_Indicator : public Extension
std::vector<byte> serialize() const override;
- bool empty() const override { return sni_host_name == ""; }
+ bool empty() const override { return sni_host_name.empty(); }
private:
std::string sni_host_name;
};
@@ -115,7 +115,7 @@ class SRP_Identifier : public Extension
std::vector<byte> serialize() const override;
- bool empty() const override { return srp_identifier == ""; }
+ bool empty() const override { return srp_identifier.empty(); }
private:
std::string srp_identifier;
};
diff --git a/src/lib/tls/tls_handshake_state.cpp b/src/lib/tls/tls_handshake_state.cpp
index f885d3b08..b085e378a 100644
--- a/src/lib/tls/tls_handshake_state.cpp
+++ b/src/lib/tls/tls_handshake_state.cpp
@@ -462,7 +462,7 @@ Handshake_State::understand_sig_format(const Public_Key& key,
if(this->version().supports_negotiable_signature_algorithms())
{
- if(hash_algo == "")
+ if(hash_algo.empty())
throw Decoding_Error("Counterparty did not send hash/sig IDS");
if(sig_algo != algo_name)
@@ -470,7 +470,7 @@ Handshake_State::understand_sig_format(const Public_Key& key,
}
else
{
- if(hash_algo != "" || sig_algo != "")
+ if(!hash_algo.empty() || !sig_algo.empty())
throw Decoding_Error("Counterparty sent hash/sig IDs with old version");
}
diff --git a/src/lib/tls/tls_policy.h b/src/lib/tls/tls_policy.h
index 4d496cc7d..0d8ebc7a1 100644
--- a/src/lib/tls/tls_policy.h
+++ b/src/lib/tls/tls_policy.h
@@ -326,7 +326,7 @@ class BOTAN_DLL Text_Policy : public Policy
{
const std::string v = get_str(key);
- if(v == "")
+ if(v.empty())
return def;
return split_on(v, ' ');
@@ -336,7 +336,7 @@ class BOTAN_DLL Text_Policy : public Policy
{
const std::string v = get_str(key);
- if(v == "")
+ if(v.empty())
return def;
return to_u32bit(v);
@@ -346,7 +346,7 @@ class BOTAN_DLL Text_Policy : public Policy
{
const std::string v = get_str(key);
- if(v == "")
+ if(v.empty())
return def;
if(v == "true" || v == "True")
diff --git a/src/lib/utils/http_util/http_util.cpp b/src/lib/utils/http_util/http_util.cpp
index 6d4e7c8e8..1286e4026 100644
--- a/src/lib/utils/http_util/http_util.cpp
+++ b/src/lib/utils/http_util/http_util.cpp
@@ -127,7 +127,7 @@ Response http_sync(http_exch_fn http_transact,
else if(verb == "POST")
outbuf << "Content-Length: " << body.size() << "\r\n";
- if(content_type != "")
+ if(!content_type.empty())
outbuf << "Content-Type: " << content_type << "\r\n";
outbuf << "Connection: close\r\n\r\n";
outbuf.write(reinterpret_cast<const char*>(body.data()), body.size());
@@ -184,7 +184,7 @@ Response http_sync(http_exch_fn http_transact,
const std::string header_size = search_map(headers, std::string("Content-Length"));
- if(header_size != "")
+ if(!header_size.empty())
{
if(resp_body.size() != to_u32bit(header_size))
throw Exception("Content-Length disagreement, header says " +
diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp
index 2bf41f260..e5c8562b5 100644
--- a/src/lib/utils/parsing.cpp
+++ b/src/lib/utils/parsing.cpp
@@ -53,7 +53,7 @@ u32bit to_u32bit(const std::string& str)
*/
u32bit timespec_to_u32bit(const std::string& timespec)
{
- if(timespec == "")
+ if(timespec.empty())
return 0;
const char suffix = timespec[timespec.size()-1];
@@ -129,7 +129,7 @@ std::vector<std::string> parse_algorithm_name(const std::string& namex)
substring += c;
}
- if(substring != "")
+ if(!substring.empty())
throw Invalid_Algorithm_Name(namex);
return elems;
@@ -144,14 +144,14 @@ std::vector<std::string> split_on_pred(const std::string& str,
std::function<bool (char)> pred)
{
std::vector<std::string> elems;
- if(str == "") return elems;
+ if(str.empty()) return elems;
std::string substr;
for(auto i = str.begin(); i != str.end(); ++i)
{
if(pred(*i))
{
- if(substr != "")
+ if(!substr.empty())
elems.push_back(substr);
substr.clear();
}
@@ -159,7 +159,7 @@ std::vector<std::string> split_on_pred(const std::string& str,
substr += *i;
}
- if(substr == "")
+ if(substr.empty())
throw Invalid_Argument("Unable to split string: " + str);
elems.push_back(substr);
@@ -197,7 +197,7 @@ std::vector<u32bit> parse_asn1_oid(const std::string& oid)
if(c == '.')
{
- if(substring == "")
+ if(substring.empty())
throw Invalid_OID(oid);
oid_elems.push_back(to_u32bit(substring));
substring.clear();
@@ -206,7 +206,7 @@ std::vector<u32bit> parse_asn1_oid(const std::string& oid)
substring += c;
}
- if(substring == "")
+ if(substring.empty())
throw Invalid_OID(oid);
oid_elems.push_back(to_u32bit(substring));
diff --git a/src/lib/utils/read_cfg.cpp b/src/lib/utils/read_cfg.cpp
index 1a15f2e63..bf68c0479 100644
--- a/src/lib/utils/read_cfg.cpp
+++ b/src/lib/utils/read_cfg.cpp
@@ -38,12 +38,12 @@ std::map<std::string, std::string> read_cfg(std::istream& is)
++line;
- if(s == "" || s[0] == '#')
+ if(s.empty() || s[0] == '#')
continue;
s = clean_ws(s.substr(0, s.find('#')));
- if(s == "")
+ if(s.empty())
continue;
auto eq = s.find("=");
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index b9d99b1ce..6d419310b 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -634,7 +634,7 @@ std::string Text_Based_Test::get_next_line()
std::string line;
std::getline(*m_cur, line);
- if(line == "")
+ if(line.empty())
continue;
if(line[0] == '#')
@@ -674,7 +674,7 @@ std::vector<Test::Result> Text_Based_Test::run()
while(true)
{
const std::string line = get_next_line();
- if(line == "") // EOF
+ if(line.empty()) // EOF
break;
if(line[0] == '[' && line[line.size()-1] == ']')