mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Global: replaces NULL to nullptr
This commit is contained in:
@@ -181,7 +181,7 @@ static FFLocalIpIpv6Type getIpv6Type(struct ifaddrs* ifa) {
|
||||
return result;
|
||||
}
|
||||
|
||||
char* line = NULL;
|
||||
char* line = nullptr;
|
||||
size_t len = 0;
|
||||
while (ffStrbufGetline(&line, &len, &buffer)) {
|
||||
struct in6_addr* entry = FF_LIST_ADD(struct in6_addr, addresses);
|
||||
@@ -278,7 +278,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
options->showType,
|
||||
options->namePrefix.chars);
|
||||
|
||||
struct ifaddrs* ifAddrStruct = NULL;
|
||||
struct ifaddrs* ifAddrStruct = nullptr;
|
||||
if (getifaddrs(&ifAddrStruct) < 0) {
|
||||
FF_DEBUG("getifaddrs() failed");
|
||||
return "getifaddrs(&ifAddrStruct) failed";
|
||||
@@ -335,7 +335,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
ifa->ifa_addr->sa_family,
|
||||
(unsigned long) ifa->ifa_flags);
|
||||
|
||||
FFAdapter* adapter = NULL;
|
||||
FFAdapter* adapter = nullptr;
|
||||
FF_LIST_FOR_EACH (FFAdapter, x, adapters) {
|
||||
if (ffStrEquals(x->mac->ifa_name, ifa->ifa_name)) {
|
||||
adapter = x;
|
||||
@@ -425,7 +425,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
}
|
||||
|
||||
if (!(options->showType & FF_LOCALIP_TYPE_ALL_IPS_BIT)) {
|
||||
struct ifaddrs* ifa = NULL;
|
||||
struct ifaddrs* ifa = nullptr;
|
||||
if (isDefaultRouteIf && defaultRouteV4->preferredSourceAddrV4 != 0) {
|
||||
FF_LIST_FOR_EACH (struct ifaddrs*, pifa, adapter->ipv4) {
|
||||
struct sockaddr_in* ipv4 = (struct sockaddr_in*) (*pifa)->ifa_addr;
|
||||
@@ -468,8 +468,8 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
|
||||
if (options->ipv6Type == FF_LOCALIP_IPV6_TYPE_AUTO) {
|
||||
if (!(options->showType & FF_LOCALIP_TYPE_ALL_IPS_BIT)) {
|
||||
struct ifaddrs* selected = NULL;
|
||||
struct ifaddrs* secondary = NULL;
|
||||
struct ifaddrs* selected = nullptr;
|
||||
struct ifaddrs* secondary = nullptr;
|
||||
|
||||
FF_LIST_FOR_EACH (struct ifaddrs*, pifa, adapter->ipv6) {
|
||||
FFLocalIpIpv6Type type = getIpv6Type(*pifa);
|
||||
@@ -542,7 +542,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
|
||||
if (ifAddrStruct) {
|
||||
freeifaddrs(ifAddrStruct);
|
||||
ifAddrStruct = NULL;
|
||||
ifAddrStruct = nullptr;
|
||||
FF_DEBUG("Cleaned up interface address structures");
|
||||
}
|
||||
|
||||
@@ -988,7 +988,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
continue;
|
||||
}
|
||||
if (ffStrbufEqualS(&iface->name, ks->ks_name)) {
|
||||
if (kstat_read(kc, ks, NULL) >= 0) {
|
||||
if (kstat_read(kc, ks, nullptr) >= 0) {
|
||||
kstat_named_t* ifspeed = (kstat_named_t*) kstat_data_lookup(ks, "ifspeed");
|
||||
if (ifspeed) {
|
||||
iface->speed = (int32_t) (ifspeed->value.ui64 / 1000 / 1000);
|
||||
@@ -1007,5 +1007,5 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
}
|
||||
|
||||
FF_DEBUG("Local IP detection completed, found %u interfaces", results->length);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
(int) options->namePrefix.length,
|
||||
options->namePrefix.chars);
|
||||
|
||||
IP_ADAPTER_ADDRESSES* FF_AUTO_FREE adapter_addresses = NULL;
|
||||
IP_ADAPTER_ADDRESSES* FF_AUTO_FREE adapter_addresses = nullptr;
|
||||
|
||||
// Multiple attempts in case interfaces change while
|
||||
// we are in the middle of querying them.
|
||||
@@ -51,7 +51,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
DWORD error = GetAdaptersAddresses(
|
||||
family,
|
||||
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER,
|
||||
NULL,
|
||||
nullptr,
|
||||
adapter_addresses,
|
||||
&adapter_addresses_buffer_size);
|
||||
|
||||
@@ -266,5 +266,5 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
processedCount,
|
||||
results->length);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user