all/trivial: rename STRLEN() macro to NM_STRLEN()

We should not have defines/macros in header files without a nm/NM
prefix. STRLEN() was one of the few offenders.

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00048.html
This commit is contained in:
Thomas Haller
2016-02-12 12:34:43 +01:00
parent afaa27ddbb
commit e663b88c59
28 changed files with 84 additions and 84 deletions

View File

@@ -746,7 +746,7 @@ maybe_add_option (GHashTable *hash,
}
if (g_str_has_prefix (key, NEW_TAG))
key += STRLEN (NEW_TAG);
key += NM_STRLEN (NEW_TAG);
if (!key[0])
return;

View File

@@ -148,9 +148,9 @@ read_client_id (const char *str)
gs_free char *s = NULL;
char *p;
g_assert (!strncmp (str, CLIENTID_TAG, STRLEN (CLIENTID_TAG)));
g_assert (!strncmp (str, CLIENTID_TAG, NM_STRLEN (CLIENTID_TAG)));
str += STRLEN (CLIENTID_TAG);
str += NM_STRLEN (CLIENTID_TAG);
while (g_ascii_isspace (*str))
str++;
@@ -188,7 +188,7 @@ nm_dhcp_dhclient_get_client_id_from_config_file (const char *path)
lines = g_strsplit_set (contents, "\n\r", 0);
for (line = lines; lines && *line; line++) {
if (!strncmp (*line, CLIENTID_TAG, STRLEN (CLIENTID_TAG)))
if (!strncmp (*line, CLIENTID_TAG, NM_STRLEN (CLIENTID_TAG)))
return read_client_id (*line);
}
return NULL;

View File

@@ -146,7 +146,7 @@ take_option (GHashTable *options,
for (i = 0; requests[i].name; i++) {
if (requests[i].num == option) {
g_hash_table_insert (options,
(gpointer) (requests[i].name + STRLEN (REQPREFIX)),
(gpointer) (requests[i].name + NM_STRLEN (REQPREFIX)),
value);
break;
}
@@ -362,7 +362,7 @@ lease_to_ip4_config (const char *iface,
r = sd_dhcp_lease_get_vendor_specific (lease, &data, &data_len);
if (r >= 0)
metered = !!memmem (data, data_len, "ANDROID_METERED", STRLEN ("ANDROID_METERED"));
metered = !!memmem (data, data_len, "ANDROID_METERED", NM_STRLEN ("ANDROID_METERED"));
nm_ip4_config_set_metered (ip4_config, metered);
return ip4_config;

View File

@@ -295,9 +295,9 @@ static void
test_existing_ascii_client_id (void)
{
gs_unref_bytes GBytes *new_client_id = NULL;
char buf[STRLEN (EACID) + 1] = { 0 };
char buf[NM_STRLEN (EACID) + 1] = { 0 };
memcpy (buf + 1, EACID, STRLEN (EACID));
memcpy (buf + 1, EACID, NM_STRLEN (EACID));
new_client_id = g_bytes_new (buf, sizeof (buf));
test_config (existing_ascii_client_id_orig, existing_ascii_client_id_expected,
FALSE, NULL, NULL,