diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-03-22 19:32:47 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-03-22 19:32:47 -0700 |
commit | a09d38643b8da50c8703fd843be26553f294f0bb (patch) | |
tree | c0cb0e161c029d862f02a4dadae04029b7db1514 | |
parent | c59a93e6fbdb2a466cc8dab728104f325e1f1d14 (diff) | |
download | ofono-a09d38643b8da50c8703fd843be26553f294f0bb.tar.bz2 |
Remove some heavy nesting that is not needed at all
-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, |