mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 16:20:09 +01:00
shared: remove unused nm_utils_str_simpletokens_extract_next()
This can be replaced by nm_utils_escaped_tokens_split(). Note that nm_utils_escaped_tokens_split() does not behave exactly the same. For example, nm_utils_str_simpletokens_extract_next() would remove all backslashes and leave only the following character. nm_utils_escaped_tokens_split() instead only strips backslashes that preceed a delimiter, whitespace or another backslash. But we should have one preferred way of tokenizing, and I find this preferable, because it allows for most backslashes to appear verbatim.
This commit is contained in:
parent
d59f046bb6
commit
ced7dbe8bf
2 changed files with 0 additions and 55 deletions
|
|
@ -2691,59 +2691,6 @@ _nm_utils_unescape_plain (char *str, const char *candidates, gboolean do_strip)
|
|||
return str;
|
||||
}
|
||||
|
||||
char *
|
||||
nm_utils_str_simpletokens_extract_next (char **p_line_start)
|
||||
{
|
||||
char *s_next;
|
||||
char *s_start;
|
||||
gsize j;
|
||||
|
||||
s_start = *p_line_start;
|
||||
if (!s_start)
|
||||
return NULL;
|
||||
|
||||
s_start = nm_str_skip_leading_spaces (s_start);
|
||||
|
||||
if (s_start[0] == '\0') {
|
||||
*p_line_start = s_start;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s_next = s_start;
|
||||
j = 0;
|
||||
while (TRUE) {
|
||||
if (s_next[0] == '\0') {
|
||||
s_start[j] = '\0';
|
||||
*p_line_start = s_next;
|
||||
return s_start;
|
||||
}
|
||||
if (s_next[0] == '\\') {
|
||||
s_next++;
|
||||
if (s_next[0] == '\0') {
|
||||
/* trailing backslash at end of word. That's an error,
|
||||
* but we silently drop the backslash and signal success. */
|
||||
*p_line_start = s_next;
|
||||
if (j == 0)
|
||||
return NULL;
|
||||
s_start[j] = '\0';
|
||||
return s_start;
|
||||
}
|
||||
|
||||
s_start[j++] = (s_next++)[0];
|
||||
continue;
|
||||
}
|
||||
if (!g_ascii_isspace (s_next[0])) {
|
||||
s_start[j++] = (s_next++)[0];
|
||||
continue;
|
||||
}
|
||||
|
||||
nm_assert (j > 0);
|
||||
s_start[j] = '\0';
|
||||
*p_line_start = nm_str_skip_leading_spaces (&s_next[1]);
|
||||
return s_start;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -398,8 +398,6 @@ nm_utils_strsplit_set (const char *str,
|
|||
return nm_utils_strsplit_set_full (str, delimiters, NM_UTILS_STRSPLIT_SET_FLAGS_NONE);
|
||||
}
|
||||
|
||||
char *nm_utils_str_simpletokens_extract_next (char **p_line_start);
|
||||
|
||||
gssize nm_utils_strv_find_first (char **list, gssize len, const char *needle);
|
||||
|
||||
char **_nm_utils_strv_cleanup (char **strv,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue