cli: use nm_utils_bin2hexstr_full() in ssid_to_hex()

We already have an implementation for converting a binary
array to hex. And, it doesn't require a GString for constructing
the output that has an known length.
This commit is contained in:
Thomas Haller 2020-03-09 16:58:20 +01:00
parent b7e171c1f7
commit 652de3b8d2

View file

@ -321,19 +321,14 @@ nmc_parse_args (nmc_arg_t *arg_arr, gboolean last, int *argc, char ***argv, GErr
char *
ssid_to_hex (const char *str, gsize len)
{
GString *printable;
char *printable_str;
int i;
if (str == NULL || len == 0)
if (len == 0)
return NULL;
printable = g_string_new (NULL);
for (i = 0; i < len; i++) {
g_string_append_printf (printable, "%02X", (unsigned char) str[i]);
}
printable_str = g_string_free (printable, FALSE);
return printable_str;
return nm_utils_bin2hexstr_full (str,
len,
'\0',
TRUE,
NULL);
}
/*