diff options
| author | Ed Tanous <ed.tanous@intel.com> | 2019-10-24 11:12:47 -0700 |
|---|---|---|
| committer | James Feist <james.feist@linux.intel.com> | 2019-11-11 20:33:48 +0000 |
| commit | 99131cd04bfc4a187e7a8d63803cb8911e64a08e (patch) | |
| tree | c85b64c16b541561965f014d6e850279da04d3db | |
| parent | a9cbc9cd3c957996831d731ad50c69f920ab065b (diff) | |
| download | bmcweb-99131cd04bfc4a187e7a8d63803cb8911e64a08e.tar.gz bmcweb-99131cd04bfc4a187e7a8d63803cb8911e64a08e.zip | |
Replace all uses of NULL with nullptr
This was an automatic change made by clang-tidy. It moves all uses of
NULL to nullptr, which are equivalent, but nullptr is prefered.
Tested: Code compiles.
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Change-Id: I9526599b222693c9723a69934b599c7a5b5d1fbf
| -rw-r--r-- | http/http_server.h | 2 | ||||
| -rw-r--r-- | http/logging.h | 2 | ||||
| -rw-r--r-- | http/query_string.h | 8 | ||||
| -rw-r--r-- | include/openbmc_dbus_rest.hpp | 2 | ||||
| -rw-r--r-- | include/pam_authenticate.hpp | 4 | ||||
| -rw-r--r-- | include/ssl_key_handler.hpp | 20 | ||||
| -rw-r--r-- | redfish-core/lib/cpudimm.hpp | 4 | ||||
| -rw-r--r-- | redfish-core/lib/log_services.hpp | 2 |
8 files changed, 22 insertions, 22 deletions
diff --git a/http/http_server.h b/http/http_server.h index 82ba9d0..df42214 100644 --- a/http/http_server.h +++ b/http/http_server.h @@ -95,7 +95,7 @@ class Server void updateDateStr() { - time_t lastTimeT = time(0); + time_t lastTimeT = time(nullptr); tm myTm{}; gmtime_r(&lastTimeT, &myTm); diff --git a/http/logging.h b/http/logging.h index a608f1f..eb04cc1 100644 --- a/http/logging.h +++ b/http/logging.h @@ -27,7 +27,7 @@ class logger { std::string date; date.resize(32, '\0'); - time_t t = time(0); + time_t t = time(nullptr); tm myTm{}; diff --git a/http/query_string.h b/http/query_string.h index 959eb68..10753ac 100644 --- a/http/query_string.h +++ b/http/query_string.h @@ -138,7 +138,7 @@ inline size_t qsParse(char* qs, char* qs_kv[], size_t qs_kv_size) for (i = 0; i < qs_kv_size; i++) { - qs_kv[i] = NULL; + qs_kv[i] = nullptr; } // find the beginning of the k/v substrings or the fragment @@ -255,7 +255,7 @@ inline char* qsK2v(const char* key, char* const* qs_kv, int qs_kv_size, } #endif // _qsSORTING - return NULL; + return nullptr; } inline char* qsScanvalue(const char* key, const char* qs, char* val, @@ -265,7 +265,7 @@ inline char* qsScanvalue(const char* key, const char* qs, char* val, const char* tmp; // find the beginning of the k/v substrings - if ((tmp = strchr(qs, '?')) != NULL) + if ((tmp = strchr(qs, '?')) != nullptr) { qs = tmp + 1; } @@ -282,7 +282,7 @@ inline char* qsScanvalue(const char* key, const char* qs, char* val, if (qs[0] == '\0') { - return NULL; + return nullptr; } qs += strcspn(qs, "=&#"); diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp index c8673d1..73986b9 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -1071,7 +1071,7 @@ int readStructFromMessage(const std::string &typeCode, int readVariantFromMessage(sdbusplus::message::message &m, nlohmann::json &data) { const char *containerType; - int r = sd_bus_message_peek_type(m.get(), NULL, &containerType); + int r = sd_bus_message_peek_type(m.get(), nullptr, &containerType); if (r < 0) { BMCWEB_LOG_ERROR << "sd_bus_message_peek_type failed"; diff --git a/include/pam_authenticate.hpp b/include/pam_authenticate.hpp index 464f171..5d78efc 100644 --- a/include/pam_authenticate.hpp +++ b/include/pam_authenticate.hpp @@ -54,7 +54,7 @@ inline bool pamAuthenticateUser(const std::string_view username, std::string passStr(password); const struct pam_conv localConversation = { pamFunctionConversation, const_cast<char*>(passStr.c_str())}; - pam_handle_t* localAuthHandle = NULL; // this gets set by pam_start + pam_handle_t* localAuthHandle = nullptr; // this gets set by pam_start if (pam_start("webserver", userStr.c_str(), &localConversation, &localAuthHandle) != PAM_SUCCESS) @@ -91,7 +91,7 @@ inline int pamUpdatePassword(const std::string& username, { const struct pam_conv localConversation = { pamFunctionConversation, const_cast<char*>(password.c_str())}; - pam_handle_t* localAuthHandle = NULL; // this gets set by pam_start + pam_handle_t* localAuthHandle = nullptr; // this gets set by pam_start int retval = pam_start("passwd", username.c_str(), &localConversation, &localAuthHandle); diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp index 2bd1f59..84aa097 100644 --- a/include/ssl_key_handler.hpp +++ b/include/ssl_key_handler.hpp @@ -56,7 +56,7 @@ inline bool validateCertificate(X509 *const cert) return false; } - int errCode = X509_STORE_CTX_init(storeCtx, x509Store, cert, NULL); + int errCode = X509_STORE_CTX_init(storeCtx, x509Store, cert, nullptr); if (errCode != 1) { BMCWEB_LOG_ERROR << "Error occured during X509_STORE_CTX_init call"; @@ -107,9 +107,9 @@ inline bool verifyOpensslKeyCert(const std::string &filepath) std::cout << "Checking certs in file " << filepath << "\n"; FILE *file = fopen(filepath.c_str(), "r"); - if (file != NULL) + if (file != nullptr) { - EVP_PKEY *pkey = PEM_read_PrivateKey(file, NULL, NULL, NULL); + EVP_PKEY *pkey = PEM_read_PrivateKey(file, nullptr, nullptr, nullptr); if (pkey != nullptr) { RSA *rsa = EVP_PKEY_get1_RSA(pkey); @@ -154,7 +154,7 @@ inline bool verifyOpensslKeyCert(const std::string &filepath) // key order issue. fseek(file, 0, SEEK_SET); - X509 *x509 = PEM_read_X509(file, NULL, NULL, NULL); + X509 *x509 = PEM_read_X509(file, nullptr, nullptr, nullptr); if (x509 == nullptr) { std::cout << "error getting x509 cert " << ERR_get_error() @@ -176,7 +176,7 @@ inline bool verifyOpensslKeyCert(const std::string &filepath) inline void generateSslCertificate(const std::string &filepath) { - FILE *pFile = NULL; + FILE *pFile = nullptr; std::cout << "Generating new keys\n"; initOpenssl(); @@ -233,19 +233,19 @@ inline void generateSslCertificate(const std::string &filepath) if (pFile != nullptr) { - PEM_write_PrivateKey(pFile, pRsaPrivKey, NULL, NULL, 0, 0, - NULL); + PEM_write_PrivateKey(pFile, pRsaPrivKey, nullptr, nullptr, 0, + nullptr, nullptr); PEM_write_X509(pFile, x509); fclose(pFile); - pFile = NULL; + pFile = nullptr; } X509_free(x509); } EVP_PKEY_free(pRsaPrivKey); - pRsaPrivKey = NULL; + pRsaPrivKey = nullptr; } // cleanup_openssl(); @@ -253,7 +253,7 @@ inline void generateSslCertificate(const std::string &filepath) EVP_PKEY *createEcKey() { - EVP_PKEY *pKey = NULL; + EVP_PKEY *pKey = nullptr; int eccgrp = 0; eccgrp = OBJ_txt2nid("prime256v1"); diff --git a/redfish-core/lib/cpudimm.hpp b/redfish-core/lib/cpudimm.hpp index d8d4191..ce36a0b 100644 --- a/redfish-core/lib/cpudimm.hpp +++ b/redfish-core/lib/cpudimm.hpp @@ -71,8 +71,8 @@ void getCpuDataByInterface(std::shared_ptr<AsyncResp> aResp, { BMCWEB_LOG_DEBUG << "Get CPU resources by interface."; - const bool *present = NULL; - const bool *functional = NULL; + const bool *present = nullptr; + const bool *functional = nullptr; for (const auto &interface : cpuInterfacesProperties) { for (const auto &property : interface.second) diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index 643be9b..2eb00b6 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -190,7 +190,7 @@ static bool getEntryTimestamp(sd_journal *journal, std::string &entryTimestamp) static_cast<time_t>(timestamp / 1000 / 1000); // Convert from us to s struct tm *loctime = localtime(&t); char entryTime[64] = {}; - if (NULL != loctime) + if (nullptr != loctime) { strftime(entryTime, sizeof(entryTime), "%FT%T%z", loctime); } |

