mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 17:50:16 +01:00
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:
parent
b7e171c1f7
commit
652de3b8d2
1 changed files with 6 additions and 11 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue