diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc index 3baa64047ec4f1..626a1e2c9a6389 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -840,8 +840,7 @@ void SecureContext::SetECDHCurve(const FunctionCallbackInfo& args) { Utf8Value curve(env->isolate(), args[0]); - if (strcmp(*curve, "auto") != 0 && - !SSL_CTX_set1_curves_list(sc->ctx_.get(), *curve)) { + if (curve != "auto" && !SSL_CTX_set1_curves_list(sc->ctx_.get(), *curve)) { return THROW_ERR_CRYPTO_OPERATION_FAILED(env, "Failed to set ECDH curve"); } } diff --git a/src/crypto/crypto_tls.cc b/src/crypto/crypto_tls.cc index 05b5828c18b5a2..cc2f6d60e75990 100644 --- a/src/crypto/crypto_tls.cc +++ b/src/crypto/crypto_tls.cc @@ -1350,8 +1350,7 @@ unsigned int TLSWrap::PskServerCallback( // Make sure there are no utf8 replacement symbols. Utf8Value identity_utf8(env->isolate(), identity_str); - if (strcmp(*identity_utf8, identity) != 0) - return 0; + if (identity_utf8 != identity) return 0; Local argv[] = { identity_str, diff --git a/src/node_report.cc b/src/node_report.cc index f6439623de01e4..94f31663d2c736 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -401,7 +401,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer, continue; } node::Utf8Value k(isolate, key); - if (!strcmp(*k, "stack") || !strcmp(*k, "message")) continue; + if (k == "stack" || k == "message") continue; node::Utf8Value v(isolate, value_string); writer->json_keyvalue(k.ToStringView(), v.ToStringView()); } diff --git a/src/util.h b/src/util.h index d06128e4d5bc94..52dd334d07d8b1 100644 --- a/src/util.h +++ b/src/util.h @@ -531,9 +531,8 @@ class Utf8Value : public MaybeStackBuffer { return std::string_view(out(), length()); } - inline bool operator==(const char* a) const { - return strcmp(out(), a) == 0; - } + inline bool operator==(const char* a) const { return strcmp(out(), a) == 0; } + inline bool operator!=(const char* a) const { return !(*this == a); } }; class TwoByteValue : public MaybeStackBuffer {