Using typedefs for function prototypes and -pointers throughout the stack for clarity

This commit is contained in:
goldsimon
2010-01-14 20:02:15 +00:00
parent b463562241
commit 2d4e76874c
15 changed files with 245 additions and 184 deletions

View File

@@ -42,7 +42,7 @@
* Call netif_add() inside the tcpip_thread context.
*/
void
do_netifapi_netif_add( struct netifapi_msg_msg *msg)
do_netifapi_netif_add(struct netifapi_msg_msg *msg)
{
if (!netif_add( msg->netif,
msg->msg.add.ipaddr,
@@ -62,7 +62,7 @@ do_netifapi_netif_add( struct netifapi_msg_msg *msg)
* Call netif_set_addr() inside the tcpip_thread context.
*/
void
do_netifapi_netif_set_addr( struct netifapi_msg_msg *msg)
do_netifapi_netif_set_addr(struct netifapi_msg_msg *msg)
{
netif_set_addr( msg->netif,
msg->msg.add.ipaddr,
@@ -77,11 +77,10 @@ do_netifapi_netif_set_addr( struct netifapi_msg_msg *msg)
* tcpip_thread context.
*/
void
do_netifapi_netif_common( struct netifapi_msg_msg *msg)
do_netifapi_netif_common(struct netifapi_msg_msg *msg)
{
if (msg->msg.common.errtfunc!=NULL) {
msg->err =
msg->msg.common.errtfunc(msg->netif);
if (msg->msg.common.errtfunc != NULL) {
msg->err = msg->msg.common.errtfunc(msg->netif);
} else {
msg->err = ERR_OK;
msg->msg.common.voidfunc(msg->netif);
@@ -101,8 +100,8 @@ netifapi_netif_add(struct netif *netif,
struct ip_addr *netmask,
struct ip_addr *gw,
void *state,
err_t (* init)(struct netif *netif),
err_t (* input)(struct pbuf *p, struct netif *netif))
netif_init_fn init,
netif_input_fn input)
{
struct netifapi_msg msg;
msg.function = do_netifapi_netif_add;
@@ -146,9 +145,8 @@ netifapi_netif_set_addr(struct netif *netif,
* @note use only for functions where there is only "netif" parameter.
*/
err_t
netifapi_netif_common( struct netif *netif,
void (* voidfunc)(struct netif *netif),
err_t (* errtfunc)(struct netif *netif) )
netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc,
netifapi_errt_fn errtfunc)
{
struct netifapi_msg msg;
msg.function = do_netifapi_netif_common;

View File

@@ -50,7 +50,7 @@
#include "netif/ppp_oe.h"
/* global variables */
static void (* tcpip_init_done)(void *arg);
static tcpip_init_done_fn tcpip_init_done;
static void *tcpip_init_done_arg;
static sys_mbox_t mbox = SYS_MBOX_NULL;
@@ -115,7 +115,7 @@ tcpip_thread(void *arg)
case TCPIP_MSG_CALLBACK:
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg));
msg->msg.cb.f(msg->msg.cb.ctx);
msg->msg.cb.function(msg->msg.cb.ctx);
memp_free(MEMP_TCPIP_MSG_API, msg);
break;
@@ -178,7 +178,7 @@ tcpip_input(struct pbuf *p, struct netif *inp)
* @return ERR_OK if the function was called, another err_t if not
*/
err_t
tcpip_callback_with_block(void (*f)(void *ctx), void *ctx, u8_t block)
tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block)
{
struct tcpip_msg *msg;
@@ -189,7 +189,7 @@ tcpip_callback_with_block(void (*f)(void *ctx), void *ctx, u8_t block)
}
msg->type = TCPIP_MSG_CALLBACK;
msg->msg.cb.f = f;
msg->msg.cb.function = function;
msg->msg.cb.ctx = ctx;
if (block) {
sys_mbox_post(mbox, msg);
@@ -365,7 +365,7 @@ tcpip_netifapi_lock(struct netifapi_msg* netifapimsg)
* @param arg argument to pass to initfunc
*/
void
tcpip_init(void (* initfunc)(void *), void *arg)
tcpip_init(tcpip_init_done_fn initfunc, void *arg)
{
lwip_init();