mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Global: replaces NULL to nullptr
This commit is contained in:
@@ -52,7 +52,7 @@ bool detectUserBySystemd(const FFstrbuf* pathUsers, FFlist* users) {
|
||||
FF_STRBUF_AUTO_DESTROY remoteHost = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY service = ffStrbufCreate();
|
||||
|
||||
char* token = NULL;
|
||||
char* token = nullptr;
|
||||
size_t n = 0;
|
||||
while (ffStrbufGetdelim(&token, &n, ' ', &sessions)) {
|
||||
ffStrbufSubstrBefore(&pathSessions, pathSessionsBaseLen);
|
||||
@@ -116,7 +116,7 @@ const char* detectBySystemd(FFUsersOptions* options, FFlist* users) {
|
||||
ffStrbufSubstrBefore(&pathUsers, pathUsersBaseLen);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -132,12 +132,12 @@ static void fillUtmpIpAddr(FFUserResult* user, struct utmpx* n) {
|
||||
|
||||
if (isIpv6) {
|
||||
char ipv6_str[INET6_ADDRSTRLEN];
|
||||
if (inet_ntop(AF_INET6, n->ut_addr_v6, ipv6_str, INET6_ADDRSTRLEN) != NULL) {
|
||||
if (inet_ntop(AF_INET6, n->ut_addr_v6, ipv6_str, INET6_ADDRSTRLEN) != nullptr) {
|
||||
ffStrbufSetS(&user->clientIp, ipv6_str);
|
||||
}
|
||||
} else if (n->ut_addr_v6[0] != 0) {
|
||||
char ipv4_str[INET_ADDRSTRLEN];
|
||||
if (inet_ntop(AF_INET, n->ut_addr_v6, ipv4_str, INET_ADDRSTRLEN) != NULL) {
|
||||
if (inet_ntop(AF_INET, n->ut_addr_v6, ipv4_str, INET_ADDRSTRLEN) != nullptr) {
|
||||
ffStrbufSetS(&user->clientIp, ipv4_str);
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ static void fillUtmpIpAddr(FF_A_UNUSED FFUserResult* user, FF_A_UNUSED struct ut
|
||||
#endif
|
||||
|
||||
const char* detectByUtmp(FFUsersOptions* options, FFlist* users) {
|
||||
struct utmpx* n = NULL;
|
||||
struct utmpx* n = nullptr;
|
||||
setutxent();
|
||||
|
||||
next:
|
||||
@@ -185,7 +185,7 @@ next:
|
||||
|
||||
endutxent();
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* ffDetectUsers(FFUsersOptions* options, FFlist* users) {
|
||||
@@ -200,5 +200,5 @@ const char* ffDetectUsers(FFUsersOptions* options, FFlist* users) {
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -35,5 +35,5 @@ next:
|
||||
user->loginTime = (uint64_t) n.ut_time * 1000;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ const char* ffDetectUsers(FFUsersOptions* options, FFlist* users) {
|
||||
user->loginTime = 0;
|
||||
|
||||
DWORD bytes = 0;
|
||||
PWTS_CLIENT_ADDRESS address = NULL;
|
||||
PWTS_CLIENT_ADDRESS address = nullptr;
|
||||
if (WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, session->SessionId, WTSClientAddress, (LPWSTR*) &address, &bytes)) {
|
||||
if (address->AddressFamily == AF_INET) {
|
||||
ffStrbufSetF(&user->clientIp, "%u.%u.%u.%u", address->Address[2], address->Address[3], address->Address[4], address->Address[5]);
|
||||
@@ -48,7 +48,7 @@ const char* ffDetectUsers(FFUsersOptions* options, FFlist* users) {
|
||||
}
|
||||
|
||||
bytes = 0;
|
||||
PWTSINFOW wtsInfo = NULL;
|
||||
PWTSINFOW wtsInfo = nullptr;
|
||||
if (WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, session->SessionId, WTSSessionInfo, (LPWSTR*) &wtsInfo, &bytes)) {
|
||||
user->loginTime = ffFileTimeToUnixMs((uint64_t) wtsInfo->LogonTime.QuadPart);
|
||||
WTSFreeMemory(wtsInfo);
|
||||
@@ -57,5 +57,5 @@ const char* ffDetectUsers(FFUsersOptions* options, FFlist* users) {
|
||||
|
||||
WTSFreeMemoryExW(WTSTypeSessionInfoLevel1, sessionInfo, 1);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user