Make the state variable an enum, and add a case for the IN_SKIP value.

Also indicate what the states mean.

Change-Id: Ie1701bb2fb33334bcd66d325d1368c2a15cbb7e8
Reviewed-on: https://code.wireshark.org/review/3061
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-07-15 13:54:54 -07:00
parent 9ba0a18d12
commit 9d436346c3
1 changed files with 10 additions and 2 deletions

View File

@ -3288,8 +3288,14 @@ int
read_prefs_file(const char *pf_path, FILE *pf,
pref_set_pair_cb pref_set_pair_fct, void *private_data)
{
enum { START, IN_VAR, PRE_VAL, IN_VAL, IN_SKIP };
int got_c, state = START;
enum {
START, /* beginning of a line */
IN_VAR, /* processing key name */
PRE_VAL, /* finished processing key name, skipping white space befor evalue */
IN_VAL, /* processing value */
IN_SKIP /* skipping to the end of the line */
} state = START;
int got_c;
GString *cur_val;
GString *cur_var;
gboolean got_val = FALSE;
@ -3422,6 +3428,8 @@ read_prefs_file(const char *pf_path, FILE *pf,
case IN_VAL:
g_string_append_c(cur_val, (gchar) got_c);
break;
case IN_SKIP:
break;
}
}
if (cur_var->len > 0) {