mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 06:28:05 +02:00
device: use static array for modules in share_init()
A static const array is marked as immutable by the linker. This is what we want, because there is no need to change this array. Also, the tailing %NULL entry is not necessary, we can just iterate over the fixed number of elements.
This commit is contained in:
parent
379dde287c
commit
0438820805
1 changed files with 12 additions and 13 deletions
|
|
@ -11536,17 +11536,16 @@ activate_stage4_ip_config_timeout_6(NMDevice *self)
|
|||
static gboolean
|
||||
share_init(NMDevice *self, GError **error)
|
||||
{
|
||||
char * modules[] = {"ip_tables",
|
||||
"iptable_nat",
|
||||
"nf_nat_ftp",
|
||||
"nf_nat_irc",
|
||||
"nf_nat_sip",
|
||||
"nf_nat_tftp",
|
||||
"nf_nat_pptp",
|
||||
"nf_nat_h323",
|
||||
NULL};
|
||||
char **iter;
|
||||
int errsv;
|
||||
const char *const modules[] = {"ip_tables",
|
||||
"iptable_nat",
|
||||
"nf_nat_ftp",
|
||||
"nf_nat_irc",
|
||||
"nf_nat_sip",
|
||||
"nf_nat_tftp",
|
||||
"nf_nat_pptp",
|
||||
"nf_nat_h323"};
|
||||
guint i;
|
||||
int errsv;
|
||||
|
||||
if (nm_platform_sysctl_get_int32(nm_device_get_platform(self),
|
||||
NMP_SYSCTL_PATHID_ABSOLUTE("/proc/sys/net/ipv4/ip_forward"),
|
||||
|
|
@ -11584,8 +11583,8 @@ share_init(NMDevice *self, GError **error)
|
|||
nm_strerror_native(errsv));
|
||||
}
|
||||
|
||||
for (iter = modules; *iter; iter++)
|
||||
nm_utils_modprobe(NULL, FALSE, *iter, NULL);
|
||||
for (i = 0; i < G_N_ELEMENTS(modules); i++)
|
||||
nm_utils_modprobe(NULL, FALSE, modules[i], NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue