mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-16 17:01:22 +01:00
shared: add nm_utils_buf_utf8safe_escape_cp() helper
(cherry picked from commit393bc8c8f6) (cherry picked from commit10b0260d19) (cherry picked from commitff8ba801f3)
This commit is contained in:
parent
106528e829
commit
5838f82707
2 changed files with 12 additions and 0 deletions
|
|
@ -2114,6 +2114,17 @@ nm_utils_buf_utf8safe_escape_bytes (GBytes *bytes, NMUtilsStrUtf8SafeFlags flags
|
|||
return nm_utils_buf_utf8safe_escape (p, l, flags, to_free);
|
||||
}
|
||||
|
||||
char *
|
||||
nm_utils_buf_utf8safe_escape_cp (gconstpointer buf, gssize buflen, NMUtilsStrUtf8SafeFlags flags)
|
||||
{
|
||||
const char *s_const;
|
||||
char *s;
|
||||
|
||||
s_const = nm_utils_buf_utf8safe_escape (buf, buflen, flags, &s);
|
||||
nm_assert (!s || s == s_const);
|
||||
return s ?: g_strdup (s_const);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *
|
||||
|
|
|
|||
|
|
@ -889,6 +889,7 @@ typedef enum {
|
|||
} NMUtilsStrUtf8SafeFlags;
|
||||
|
||||
const char *nm_utils_buf_utf8safe_escape (gconstpointer buf, gssize buflen, NMUtilsStrUtf8SafeFlags flags, char **to_free);
|
||||
char *nm_utils_buf_utf8safe_escape_cp (gconstpointer buf, gssize buflen, NMUtilsStrUtf8SafeFlags flags);
|
||||
const char *nm_utils_buf_utf8safe_escape_bytes (GBytes *bytes, NMUtilsStrUtf8SafeFlags flags, char **to_free);
|
||||
gconstpointer nm_utils_buf_utf8safe_unescape (const char *str, gsize *out_len, gpointer *to_free);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue