diff options
author | Michael Mann <mmann78@netscape.net> | 2017-01-07 08:52:23 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-01-22 10:43:57 +0000 |
commit | 21a3b8cc71ac127e21375c62e0a738db8f3ea286 (patch) | |
tree | 5295e34869b8968b328fbf197815ae3d168e0d5e /ui/preference_utils.c | |
parent | 76cf1d0b0a0b804b24bea6afb4a4620a1607b144 (diff) |
Internalize struct preference
Move "struct preference" into prefs.c, essentially creating a "private"
structure to handle preferences. The 2 motivating factors were:
1. Better memory management so that clients/users of API don't have to worry
about it.
2. Hide the ugliness of the union stuff and make it transparent to the API.
A few bugs related to preference <-> Decode As integration were fixed
while in the neighborhood.
Change-Id: I509b9a236235d066b139c98222b701475e0ed365
Reviewed-on: https://code.wireshark.org/review/19578
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/preference_utils.c')
-rw-r--r-- | ui/preference_utils.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/ui/preference_utils.c b/ui/preference_utils.c index b40935c40d..0aebb692e0 100644 --- a/ui/preference_utils.c +++ b/ui/preference_utils.c @@ -101,17 +101,9 @@ prefs_store_ext_helper(const char * module_name, const char *pref_name, const ch if (!pref) return FALSE; - if ( pref->type == PREF_STRING ) + if (prefs_get_type(pref) == PREF_STRING ) { - g_free((void *)pref->stashed_val.string); - pref->stashed_val.string = (gchar *) g_strdup(pref_value); - /* unstash - taken from preferences_util */ - if (strcmp(*pref->varp.string, pref->stashed_val.string) != 0) - { - pref_changed = TRUE; - g_free(*pref->varp.string); - *pref->varp.string = g_strdup(pref->stashed_val.string); - } + pref_changed = prefs_set_string_value(pref, pref_value, pref_stashed); } return pref_changed; |