diff options
author | João Valverde <j@v6e.pt> | 2021-11-29 13:09:03 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2021-11-29 18:37:03 +0000 |
commit | dcbd79584d80672c87629ace67af260719b11ded (patch) | |
tree | 44ecf1f655a184a5dbfeb1f7ca4db37acc8b67c6 /epan/strutil.c | |
parent | 8e63faff95657fdb5758997f24fd2e1f9ddc2456 (diff) |
epan/str_util: Remove unused functions
Remove ws_strdup_escape_char(). I don't think it is generic enough to keep,
and it does not seem very efficient either.
Remove string_replace(). This function was used in the GTK GUI.
Diffstat (limited to 'epan/strutil.c')
-rw-r--r-- | epan/strutil.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/epan/strutil.c b/epan/strutil.c index 4cfb00ef21..35de09a98f 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -1504,81 +1504,6 @@ IA5_7BIT_decode(unsigned char * dest, const unsigned char* src, int len) dest[i]=0; } -/* - * This function takes a string and copies it, inserting a 'chr' before - * every 'chr' in it. - */ -gchar* -ws_strdup_escape_char (const gchar *str, const gchar chr) -{ - const gchar *p; - gchar *q, *new_str; - - if(!str) - return NULL; - - p = str; - /* Worst case: A string that is full of 'chr' */ - q = new_str = (gchar *)g_malloc (strlen(str) * 2 + 1); - - while(*p != 0) { - if(*p == chr) - *q++ = chr; - - *q++ = *p++; - } - *q = '\0'; - - return new_str; -} - -/* - * This function takes a string and copies it, removing any occurences of double - * 'chr' with a single 'chr'. - */ -gchar* -ws_strdup_unescape_char (const gchar *str, const char chr) -{ - const gchar *p; - gchar *q, *new_str; - - if(!str) - return NULL; - - p = str; - /* Worst case: A string that contains no 'chr' */ - q = new_str = (gchar *)g_malloc (strlen(str) + 1); - - while(*p != 0) { - *q++ = *p; - if ((*p == chr) && (*(p+1) == chr)) - p += 2; - else - p++; - } - *q = '\0'; - - return new_str; -} - -/* Create a newly-allocated string with replacement values. */ -gchar * -string_replace(const gchar* str, const gchar *old_val, const gchar *new_val) -{ - gchar **str_parts; - gchar *new_str; - - if (!str || !old_val) { - return NULL; - } - - str_parts = g_strsplit(str, old_val, 0); - new_str = g_strjoinv(new_val, str_parts); - g_strfreev(str_parts); - - return new_str; -} - /* chars allowed: lower case letters, digits, '-', "_", and ".". */ static const guint8 module_valid_chars_lower_case[128] = { |