mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-09 05:00:36 +01:00
shared: add nm_hexchar() helper
This commit is contained in:
parent
d53abfd989
commit
069be33fbd
2 changed files with 14 additions and 0 deletions
|
|
@ -23,6 +23,9 @@ G_STATIC_ASSERT (G_STRUCT_OFFSET (NMUtilsNamedValue, value_ptr) == sizeof (const
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
const char _nm_hexchar_table_lower[16] = "0123456789abcdef";
|
||||
const char _nm_hexchar_table_upper[16] = "0123456789ABCDEF";
|
||||
|
||||
const void *const _NM_PTRARRAY_EMPTY[1] = { NULL };
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1809,6 +1809,17 @@ int nm_utils_getpagesize (void);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
extern const char _nm_hexchar_table_lower[16];
|
||||
extern const char _nm_hexchar_table_upper[16];
|
||||
|
||||
static inline char
|
||||
nm_hexchar (int x, gboolean upper_case)
|
||||
{
|
||||
return upper_case
|
||||
? _nm_hexchar_table_upper[x & 15]
|
||||
: _nm_hexchar_table_lower[x & 15];
|
||||
}
|
||||
|
||||
char *nm_utils_bin2hexstr_full (gconstpointer addr,
|
||||
gsize length,
|
||||
char delimiter,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue