find_val_for_string() is only used in prefs.c so remove the prototype
and make it static. When reading enum preferences, use the current value of the preference as the default value of the preference instead of a hard-coded 1. This way if we couldn't find the appropriate value we'll don't end up changing the preference to something that may or may not make sense. svn path=/trunk/; revision=32950
This commit is contained in:
parent
71de391514
commit
c420b83ee5
|
@ -42,7 +42,7 @@ struct pref_module {
|
|||
};
|
||||
|
||||
/*
|
||||
* Module used for protocol preferences.
|
||||
* Module used for protocol preferences.
|
||||
* With MSVC and a libwireshark.dll, we need a special declaration.
|
||||
*/
|
||||
WS_VAR_IMPORT module_t *protocols_module;
|
||||
|
@ -97,10 +97,6 @@ struct preference {
|
|||
void *control; /* handle for GUI control for this preference */
|
||||
};
|
||||
|
||||
gint find_val_for_string(const char *needle, const enum_val_t *haystack,
|
||||
gint default_value);
|
||||
|
||||
|
||||
/* read_prefs_file: read in a generic config file and do a callback to */
|
||||
/* pref_set_pair_fct() for every key/value pair found */
|
||||
typedef prefs_set_pref_e (*pref_set_pair_cb) (gchar *key, gchar *value, void *private_data);
|
||||
|
|
|
@ -988,9 +988,9 @@ prefs_clear_string_list(GList *sl)
|
|||
* Otherwise, the default value that was passed as the third argument is
|
||||
* returned.
|
||||
*/
|
||||
gint
|
||||
static gint
|
||||
find_val_for_string(const char *needle, const enum_val_t *haystack,
|
||||
gint default_value)
|
||||
gint default_value)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -2551,8 +2551,8 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_)
|
|||
|
||||
case PREF_ENUM:
|
||||
/* XXX - give an error if it doesn't match? */
|
||||
enum_val = find_val_for_string(value,
|
||||
pref->info.enum_info.enumvals, 1);
|
||||
enum_val = find_val_for_string(value, pref->info.enum_info.enumvals,
|
||||
*pref->varp.enump);
|
||||
if (*pref->varp.enump != enum_val) {
|
||||
module->prefs_changed = TRUE;
|
||||
*pref->varp.enump = enum_val;
|
||||
|
|
Loading…
Reference in New Issue