summaryrefslogtreecommitdiff
path: root/shared/nm-utils
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-04-17 17:30:27 +0200
committerThomas Haller <thaller@redhat.com>2019-04-18 17:53:09 +0200
commit304eab8703dc1c77211d0c7f32a76932b725bd86 (patch)
tree837ffcd5b20dc73756c9e0c840a8a47933a4ec96 /shared/nm-utils
parent941f27d350f8d086d3dbdda7ae19f6e4fa2856cf (diff)
downloadNetworkManager-304eab8703dc1c77211d0c7f32a76932b725bd86.tar.gz
shared: remove unused _nm_utils_escape_plain()/_nm_utils_escape_spaces() API
... and the "unescape" variants. This is replaced by nm_utils_escaped_tokens_split() and nm_utils_escaped_tokens_escape*() API.
Diffstat (limited to 'shared/nm-utils')
-rw-r--r--shared/nm-utils/nm-shared-utils.c75
-rw-r--r--shared/nm-utils/nm-shared-utils.h17
2 files changed, 0 insertions, 92 deletions
diff --git a/shared/nm-utils/nm-shared-utils.c b/shared/nm-utils/nm-shared-utils.c
index 06cd481ebb..cf08a77fde 100644
--- a/shared/nm-utils/nm-shared-utils.c
+++ b/shared/nm-utils/nm-shared-utils.c
@@ -2618,81 +2618,6 @@ _nm_utils_user_data_unpack (gpointer user_data, int nargs, ...)
/*****************************************************************************/
-const char *
-_nm_utils_escape_plain (const char *str, const char *candidates, char **to_free)
-{
- const char *ptr = str;
- char *ret, *r;
- guint8 ch_lookup[256];
-
- *to_free = NULL;
-
- if (!str)
- return NULL;
-
- _char_lookup_table_init (ch_lookup, candidates ?: NM_ASCII_SPACES);
-
- while (TRUE) {
- if (!*ptr)
- return str;
- if (_char_lookup_has (ch_lookup, *ptr))
- break;
- ptr++;
- }
-
- ptr = str;
- ret = g_new (char, strlen (str) * 2 + 1);
- r = ret;
- *to_free = ret;
- while (*ptr) {
- if (_char_lookup_has (ch_lookup, *ptr))
- *r++ = '\\';
- *r++ = *ptr++;
- }
- *r = '\0';
-
- return ret;
-}
-
-char *
-_nm_utils_unescape_plain (char *str, const char *candidates, gboolean do_strip)
-{
- gsize i = 0;
- gsize j = 0;
- gsize preserve_space_at = 0;
- guint8 ch_lookup[256];
-
- if (!str)
- return NULL;
-
- _char_lookup_table_init (ch_lookup, candidates ?: NM_ASCII_SPACES);
-
- if (do_strip) {
- while (str[i] && _char_lookup_has (ch_lookup, str[i]))
- i++;
- }
-
- for (; str[i]; i++) {
- if ( str[i] == '\\'
- && _char_lookup_has (ch_lookup, str[i+1])) {
- preserve_space_at = j;
- i++;
- }
- str[j++] = str[i];
- }
- str[j] = '\0';
-
- if (do_strip && j > 0) {
- while ( --j > preserve_space_at
- && _char_lookup_has (ch_lookup, str[j]))
- str[j] = '\0';
- }
-
- return str;
-}
-
-/*****************************************************************************/
-
typedef struct {
gpointer callback_user_data;
GCancellable *cancellable;
diff --git a/shared/nm-utils/nm-shared-utils.h b/shared/nm-utils/nm-shared-utils.h
index 6bfc37acbf..af3c2f830b 100644
--- a/shared/nm-utils/nm-shared-utils.h
+++ b/shared/nm-utils/nm-shared-utils.h
@@ -1110,23 +1110,6 @@ void _nm_utils_user_data_unpack (gpointer user_data, int nargs, ...);
/*****************************************************************************/
-const char *_nm_utils_escape_plain (const char *str, const char *candidates, char **to_free);
-char *_nm_utils_unescape_plain (char *str, const char *candidates, gboolean do_strip);
-
-static inline const char *
-_nm_utils_escape_spaces (const char *str, char **to_free)
-{
- return _nm_utils_escape_plain (str, NM_ASCII_SPACES, to_free);
-}
-
-static inline char *
-_nm_utils_unescape_spaces (char *str, gboolean do_strip)
-{
- return _nm_utils_unescape_plain (str, NM_ASCII_SPACES, do_strip);
-}
-
-/*****************************************************************************/
-
typedef void (*NMUtilsInvokeOnIdleCallback) (gpointer callback_user_data,
GCancellable *cancellable);