mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 21:40:22 +01:00
libnm: avoid strcmp in nm_vpn_service_plugin_read_vpn_details()
This commit is contained in:
parent
62c1944e7d
commit
f0dc95e517
1 changed files with 5 additions and 5 deletions
|
|
@ -803,29 +803,29 @@ nm_vpn_service_plugin_read_vpn_details(int fd, GHashTable **out_data, GHashTable
|
|||
success = TRUE; /* Got at least one value */
|
||||
}
|
||||
|
||||
if (strcmp(line->str, "DONE") == 0) {
|
||||
if (nm_streq(line->str, "DONE")) {
|
||||
/* finish marker */
|
||||
break;
|
||||
} else if (strncmp(line->str, DATA_KEY_TAG, strlen(DATA_KEY_TAG)) == 0) {
|
||||
} else if (NM_STR_HAS_PREFIX(line->str, DATA_KEY_TAG)) {
|
||||
if (nm_clear_g_string(&key))
|
||||
g_warning("a value expected");
|
||||
key = g_string_new(line->str + strlen(DATA_KEY_TAG));
|
||||
str = key;
|
||||
hash = data;
|
||||
} else if (strncmp(line->str, DATA_VAL_TAG, strlen(DATA_VAL_TAG)) == 0) {
|
||||
} else if (NM_STR_HAS_PREFIX(line->str, DATA_VAL_TAG)) {
|
||||
if (val || !key || hash != data) {
|
||||
g_warning("%s not preceded by %s", DATA_VAL_TAG, DATA_KEY_TAG);
|
||||
break;
|
||||
}
|
||||
val = g_string_new(line->str + strlen(DATA_VAL_TAG));
|
||||
str = val;
|
||||
} else if (strncmp(line->str, SECRET_KEY_TAG, strlen(SECRET_KEY_TAG)) == 0) {
|
||||
} else if (NM_STR_HAS_PREFIX(line->str, SECRET_KEY_TAG)) {
|
||||
if (nm_clear_g_string(&key))
|
||||
g_warning("a value expected");
|
||||
key = g_string_new(line->str + strlen(SECRET_KEY_TAG));
|
||||
str = key;
|
||||
hash = secrets;
|
||||
} else if (strncmp(line->str, SECRET_VAL_TAG, strlen(SECRET_VAL_TAG)) == 0) {
|
||||
} else if (NM_STR_HAS_PREFIX(line->str, SECRET_VAL_TAG)) {
|
||||
if (val || !key || hash != secrets) {
|
||||
g_warning("%s not preceded by %s", SECRET_VAL_TAG, SECRET_KEY_TAG);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue