Global: optimises usage of FFstrbuf and FFlist

This commit is contained in:
李通洲
2026-01-09 16:18:25 +08:00
parent 1337525eb5
commit b065b3da51
6 changed files with 17 additions and 7 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ const char* ffDetectDNS(FFDNSOptions* options, FFlist* results)
// Handle different DNS management services
if (results->length == 1)
{
const FFstrbuf* firstEntry = FF_LIST_GET(FFstrbuf, *results, 0);
const FFstrbuf* firstEntry = FF_LIST_FIRST(FFstrbuf, *results);
if (ffStrbufEqualS(firstEntry, "127.0.0.53"))
{
+2 -2
View File
@@ -462,7 +462,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
appendIpv4(options, &item->ipv4, ifa);
else if (adapter->ipv4.length > 0)
{
appendIpv4(options, &item->ipv4, *FF_LIST_GET(struct ifaddrs*, adapter->ipv4, 0));
appendIpv4(options, &item->ipv4, *FF_LIST_FIRST(struct ifaddrs*, adapter->ipv4));
FF_DEBUG("Using first IPv4 address for interface %s", adapter->mac->ifa_name);
}
}
@@ -527,7 +527,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
appendIpv6(options, &item->ipv6, selected);
else if (adapter->ipv6.length > 0)
{
appendIpv6(options, &item->ipv6, *FF_LIST_GET(struct ifaddrs*, adapter->ipv6, 0));
appendIpv6(options, &item->ipv6, *FF_LIST_FIRST(struct ifaddrs*, adapter->ipv6));
FF_DEBUG("Using first IPv6 address for interface %s", adapter->mac->ifa_name);
}
}
+1 -1
View File
@@ -261,7 +261,7 @@ static uint32_t getAMUser(void)
if (instance.state.platform.configDirs.length == 0) return 0;
// check if $XDG_CONFIG_HOME/appman/appman-config exists
FFstrbuf* baseDir = FF_LIST_GET(FFstrbuf, instance.state.platform.configDirs, 0);
FFstrbuf* baseDir = FF_LIST_FIRST(FFstrbuf, instance.state.platform.configDirs);
uint32_t baseLen = baseDir->length;
ffStrbufAppendS(baseDir, "appman/appman-config");
FF_STRBUF_AUTO_DESTROY packagesPath = ffStrbufCreate();