aboutsummaryrefslogtreecommitdiffstats
path: root/epan/prefs.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2012-10-27 20:29:12 +0000
committerEvan Huus <eapache@gmail.com>2012-10-27 20:29:12 +0000
commitb7ff007bbbb8b8cf46fac81c8d955faab44ee492 (patch)
tree649502e30de98338c5f981a1eff1d6c1fa5afad3 /epan/prefs.c
parent51e45c8da926778cc5df7023dd6a4a5a536fb4c0 (diff)
There's no need to g_strdup our default prefs - setting them as literals
works just fine and doesn't leak any memory. Use wmem_permanent_scope() for the one string we do have to copy, to ensure it doesn't leak either. svn path=/trunk/; revision=45812
Diffstat (limited to 'epan/prefs.c')
-rw-r--r--epan/prefs.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/epan/prefs.c b/epan/prefs.c
index a93346e46b..6612a370c8 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -56,6 +56,8 @@
#include "epan/filter_expressions.h"
+#include "epan/wmem/wmem.h"
+
/* Internal functions */
static module_t *find_subtree(module_t *parent, const char *tilte);
static module_t *prefs_register_module_or_subtree(module_t *parent,
@@ -2494,8 +2496,8 @@ pre_init_prefs(void)
prefs.pr_format = PR_FMT_TEXT;
prefs.pr_dest = PR_DEST_CMD;
- prefs.pr_file = g_strdup("wireshark.out");
- prefs.pr_cmd = g_strdup("lpr");
+ prefs.pr_file = "wireshark.out";
+ prefs.pr_cmd = "lpr";
prefs.gui_scrollbar_on_right = TRUE;
prefs.gui_plist_sel_browse = FALSE;
@@ -2509,7 +2511,7 @@ pre_init_prefs(void)
prefs.gui_toolbar_main_style = TB_STYLE_ICONS;
prefs.gui_toolbar_filter_style = TB_STYLE_TEXT;
#ifdef _WIN32
- prefs.gui_font_name = g_strdup("Lucida Console 10");
+ prefs.gui_font_name = "Lucida Console 10";
#else
/*
* XXX - for now, we make the initial font name a pattern that matches
@@ -2558,7 +2560,7 @@ pre_init_prefs(void)
*/
/* XXX - the above comment was about the GTK1 font stuff, just remove this comment now */
/* XXX- is this the correct default font name for GTK2 none win32? */
- prefs.gui_font_name = g_strdup("Monospace 10");
+ prefs.gui_font_name = "Monospace 10";
#endif
prefs.gui_marked_fg.pixel = 65535;
prefs.gui_marked_fg.red = 65535;
@@ -2576,8 +2578,8 @@ pre_init_prefs(void)
prefs.gui_ignored_bg.red = 65535;
prefs.gui_ignored_bg.green = 65535;
prefs.gui_ignored_bg.blue = 65535;
- prefs.gui_colorized_fg = g_strdup("000000,000000,000000,000000,000000,000000,000000,000000,000000,000000");
- prefs.gui_colorized_bg = g_strdup("ffc0c0,ffc0ff,e0c0e0,c0c0ff,c0e0e0,c0ffff,c0ffc0,ffffc0,e0e0c0,e0e0e0");
+ prefs.gui_colorized_fg = "000000,000000,000000,000000,000000,000000,000000,000000,000000,000000";
+ prefs.gui_colorized_bg = "ffc0c0,ffc0ff,e0c0e0,c0c0ff,c0e0e0,c0ffff,c0ffc0,ffffc0,e0e0c0,e0e0e0";
prefs.st_client_fg.pixel = 0;
prefs.st_client_fg.red = 32767;
prefs.st_client_fg.green = 0;
@@ -2602,14 +2604,14 @@ pre_init_prefs(void)
prefs.gui_fileopen_style = FO_STYLE_LAST_OPENED;
prefs.gui_recent_df_entries_max = 10;
prefs.gui_recent_files_count_max = 10;
- prefs.gui_fileopen_dir = g_strdup(get_persdatafile_dir());
+ prefs.gui_fileopen_dir = wmem_strdup(wmem_permanent_scope(), get_persdatafile_dir());
prefs.gui_fileopen_preview = 3;
prefs.gui_ask_unsaved = TRUE;
prefs.gui_find_wrap = TRUE;
prefs.gui_use_pref_save = FALSE;
- prefs.gui_webbrowser = g_strdup(HTML_VIEWER " %s");
- prefs.gui_window_title = g_strdup("");
- prefs.gui_start_title = g_strdup("The World's Most Popular Network Protocol Analyzer");
+ prefs.gui_webbrowser = HTML_VIEWER " %s";
+ prefs.gui_window_title = "";
+ prefs.gui_start_title = "The World's Most Popular Network Protocol Analyzer";
prefs.gui_version_placement = version_both;
prefs.gui_auto_scroll_on_expand = FALSE;
prefs.gui_auto_scroll_percentage = 0;