diff options
-rw-r--r-- | gatchat/ppp_cp.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c index ac5dcb3f..458b7c77 100644 --- a/gatchat/ppp_cp.c +++ b/gatchat/ppp_cp.c @@ -1057,21 +1057,21 @@ static void verify_config_option(gpointer elem, gpointer user_data) { struct ppp_option *config = elem; struct pppcp_data *data = user_data; - GList *list = NULL; - struct ppp_option *option; + guint type = config->type; + GList *list; /* * determine whether this config option is in the * acceptable options list */ - if (g_list_length(data->acceptable_options)) { - guint type = config->type; + if (g_list_length(data->acceptable_options) == 0) + return; - list = g_list_find_custom(data->acceptable_options, + list = g_list_find_custom(data->acceptable_options, GUINT_TO_POINTER(type), is_option); - } - if (!list) { + struct ppp_option *option; + /* * if the option did not exist, we need to store a copy * of the option in the unacceptable_options list so it @@ -1080,33 +1080,33 @@ static void verify_config_option(gpointer elem, gpointer user_data) option = g_try_malloc0(config->length); if (option == NULL) return; + option->type = config->type; option->length = config->length; data->unacceptable_options = g_list_append(data->unacceptable_options, option); } - } static void remove_config_option(gpointer elem, gpointer user_data) { struct ppp_option *config = elem; struct pppcp_data *data = user_data; + guint type = config->type; GList *list; /* * determine whether this config option is in the * applied options list */ - if (g_list_length(data->config_options)) { - guint type = config->type; + if (g_list_length(data->config_options) == 0) + return; - list = g_list_find_custom(data->config_options, - GUINT_TO_POINTER(type), is_option); - if (list) - data->config_options = + list = g_list_find_custom(data->config_options, + GUINT_TO_POINTER(type), is_option); + if (list) + data->config_options = g_list_delete_link(data->config_options, list); - } } static guint8 pppcp_process_configure_request(struct pppcp_data *data, |