mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-05 06:40:41 +02:00
all: prefer g_snprintf() over snprintf()
While both functions are basically the same, the majority of the time we use g_snprintf(). There is no strong reason to prefer one or the other, but let's keep using one variant.
This commit is contained in:
parent
e2bd2f3f91
commit
047d2c1d92
5 changed files with 15 additions and 15 deletions
|
|
@ -423,11 +423,11 @@ commit_port_options(NMDevice *bond_device, NMDevice *port, NMSettingBondPort *se
|
|||
* echo "eth1:2" > /sys/class/net/bond0/bonding/queue_id
|
||||
* Kernel allows parital editing, so no need to care about other bond ports.
|
||||
*/
|
||||
snprintf(queue_id_str,
|
||||
_MAX_QUEUE_ID_STR_LEN,
|
||||
"%s:%" G_GUINT32_FORMAT,
|
||||
nm_device_get_iface(port),
|
||||
set_port ? nm_setting_bond_port_get_queue_id(set_port) : NM_BOND_PORT_QUEUE_ID_DEF);
|
||||
g_snprintf(queue_id_str,
|
||||
_MAX_QUEUE_ID_STR_LEN,
|
||||
"%s:%" G_GUINT32_FORMAT,
|
||||
nm_device_get_iface(port),
|
||||
set_port ? nm_setting_bond_port_get_queue_id(set_port) : NM_BOND_PORT_QUEUE_ID_DEF);
|
||||
|
||||
nm_platform_sysctl_master_set_option(nm_device_get_platform(bond_device),
|
||||
nm_device_get_ifindex(bond_device),
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ read_interface(const char *line, char *interface, guint size)
|
|||
if (ptr[0] == '\0' || strlen(ptr) + 1 > size)
|
||||
return FALSE;
|
||||
|
||||
snprintf(interface, size, "%s", ptr);
|
||||
g_snprintf(interface, size, "%s", ptr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1494,7 +1494,7 @@ test_software_detect(gconstpointer user_data)
|
|||
* The fix (17af2bce) is included kernel 4.7, dated 24 July, 2016.
|
||||
*/
|
||||
for (i = ifindex_parent + 1; i < ifindex_parent + 100; i++) {
|
||||
snprintf(buf, sizeof(buf), "/sys/class/macvtap/tap%d", i);
|
||||
g_snprintf(buf, sizeof(buf), "/sys/class/macvtap/tap%d", i);
|
||||
if (!g_file_test(buf, G_FILE_TEST_IS_SYMLINK))
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ nm_supplicant_config_add_setting_macsec(NMSupplicantConfig *self,
|
|||
|
||||
port = nm_setting_macsec_get_port(setting);
|
||||
if (port > 0 && port < 65534) {
|
||||
snprintf(buf, sizeof(buf), "%d", port);
|
||||
g_snprintf(buf, sizeof(buf), "%d", port);
|
||||
if (!nm_supplicant_config_add_option(self, "macsec_port", buf, -1, NULL, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3794,13 +3794,13 @@ prompt_yes_no(gboolean default_yes, char *delim)
|
|||
if (!delim)
|
||||
delim = "";
|
||||
|
||||
snprintf(prompt,
|
||||
sizeof(prompt),
|
||||
"(%s/%s) [%s]%s ",
|
||||
WORD_YES,
|
||||
WORD_NO,
|
||||
default_yes ? WORD_YES : WORD_NO,
|
||||
delim);
|
||||
g_snprintf(prompt,
|
||||
sizeof(prompt),
|
||||
"(%s/%s) [%s]%s ",
|
||||
WORD_YES,
|
||||
WORD_NO,
|
||||
default_yes ? WORD_YES : WORD_NO,
|
||||
delim);
|
||||
|
||||
return prompt;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue