summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-03-22 20:07:13 -0700
committerMarcel Holtmann <marcel@holtmann.org>2010-03-22 20:07:13 -0700
commite396b7d5afcce6d90d5836d57f7b800a1b6b7b52 (patch)
tree23db31e5f63f519cb97812aadaabdd7308a50023
parent91b742730ac8e8f2585ad63a7bce631781f3ef94 (diff)
downloadofono-e396b7d5afcce6d90d5836d57f7b800a1b6b7b52.tar.bz2
Unnest some more functions in PPP CP implementation
-rw-r--r--gatchat/ppp_cp.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c
index ab10bba3..7cbcdcb3 100644
--- a/gatchat/ppp_cp.c
+++ b/gatchat/ppp_cp.c
@@ -1061,6 +1061,7 @@ static void verify_config_option(gpointer elem, gpointer user_data)
struct ppp_option *config = elem;
struct pppcp_data *data = user_data;
guint type = config->type;
+ struct ppp_option *option;
GList *list;
/*
@@ -1071,24 +1072,23 @@ static void verify_config_option(gpointer elem, gpointer user_data)
return;
list = g_list_find_custom(data->acceptable_options,
- GUINT_TO_POINTER(type), is_option);
- if (!list) {
- struct ppp_option *option;
+ GUINT_TO_POINTER(type), is_option);
+ if (list)
+ return;
- /*
- * if the option did not exist, we need to store a copy
- * of the option in the unacceptable_options list so it
- * can be nak'ed.
- */
- option = g_try_malloc0(config->length);
- if (option == NULL)
- return;
+ /*
+ * if the option did not exist, we need to store a copy
+ * of the option in the unacceptable_options list so it
+ * can be nak'ed.
+ */
+ option = g_try_malloc0(config->length);
+ if (option == NULL)
+ return;
- option->type = config->type;
- option->length = config->length;
- data->unacceptable_options =
+ 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)
@@ -1106,10 +1106,11 @@ static void remove_config_option(gpointer elem, gpointer user_data)
return;
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);
+ GUINT_TO_POINTER(type), is_option);
+ if (!list)
+ return;
+
+ data->config_options = g_list_delete_link(data->config_options, list);
}
static guint8 pppcp_process_configure_request(struct pppcp_data *data,