Refactor: Make option_scan more type safe

This commit is contained in:
Denis Kenzior 2010-04-05 14:32:11 -05:00
parent 5e8a9c2941
commit 48a012c810
4 changed files with 8 additions and 6 deletions

View File

@ -895,7 +895,7 @@ static guint8 pppcp_process_configure_request(struct pppcp_data *data,
i += option->length;
if (action->option_scan)
rval = action->option_scan(option, data);
rval = action->option_scan(data, option);
else
rval = OPTION_ERR;
@ -1039,7 +1039,7 @@ static guint8 pppcp_process_configure_nak(struct pppcp_data *data,
i += naked_option->length;
if (action->option_scan)
rval = action->option_scan(naked_option, data);
rval = action->option_scan(data, naked_option);
else
rval = OPTION_ERR;

View File

@ -40,8 +40,8 @@ struct pppcp_action {
void (*this_layer_down)(struct pppcp_data *data);
void (*this_layer_started)(struct pppcp_data *data);
void (*this_layer_finished)(struct pppcp_data *data);
enum option_rval (*option_scan)(struct ppp_option *option,
gpointer user_data);
enum option_rval (*option_scan)(struct pppcp_data *pppcp,
struct ppp_option *option);
void (*option_process)(struct pppcp_data *data,
struct ppp_option *option);
};

View File

@ -104,7 +104,8 @@ static void ipcp_finished(struct pppcp_data *data)
/*
* Scan the option to see if it is acceptable, unacceptable, or rejected
*/
static guint ipcp_option_scan(struct ppp_option *option, gpointer user)
static guint ipcp_option_scan(struct pppcp_data *pppcp,
struct ppp_option *option)
{
switch (option->type) {
case IP_ADDRESS:

View File

@ -86,7 +86,8 @@ static void lcp_finished(struct pppcp_data *pppcp)
* We need to use a default case here because this option type value
* could be anything.
*/
static guint lcp_option_scan(struct ppp_option *option, gpointer user)
static guint lcp_option_scan(struct pppcp_data *pppcp,
struct ppp_option *option)
{
switch (option->type) {
case ACCM: