summaryrefslogtreecommitdiff
path: root/epan/strutil.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2010-05-27 15:51:25 +0000
committerGerald Combs <gerald@wireshark.org>2010-05-27 15:51:25 +0000
commitfa5f6cced76ce35ed3a493abe1a12d2df75add2e (patch)
treef0e828aefc1e0da3ba482280f2a81e8c15e2c8e8 /epan/strutil.c
parent812f7c0ba757dcd0117a62033561e24179266a03 (diff)
downloadwireshark-fa5f6cced76ce35ed3a493abe1a12d2df75add2e.tar.gz
From Edgar Gladkich:
This is an extension to the Wireshark context sensitive protocol help. Rows in TreeView window are analyzed and suitable help file (as HTML) is opened in a browser. The help part (large file, 23 MB) of the Protocol Help can be downloaded under www.inacon.com/dowload/stuff/protocol_help.tar.gz This protocol help "light" provides descriptive content for the most frequently used standard protocols, including IP, TCP or SMTP. From me: Changes: Rename "ph_" in some function names to "proto_help_". Move the protocol help code to its own module. Make a bunch of functions static. Remove unused code. Use browser_open_url() instead of a custom function. Increase the logging levels. Don't clobber the normal log handler. Update some Doxygen comments to match the format in the rest of the code base. Removed GTK version checks. We've been 2.x only for a while. Move ph_replace_string to string_replace() in epan/strutil.[ch]. Fix a bunch of memory leaks. Add a NULL pointer check. Reformat the overview menu label. Document the file format and locations. Add Edgar to AUTHORS. svn path=/trunk/; revision=32995
Diffstat (limited to 'epan/strutil.c')
-rw-r--r--epan/strutil.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/epan/strutil.c b/epan/strutil.c
index ab0019cf8a..ed81ad135b 100644
--- a/epan/strutil.c
+++ b/epan/strutil.c
@@ -1090,3 +1090,19 @@ ws_strdup_unescape_underscore (const gchar *str)
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;
+}