Author: tjansen Date: Thu Oct 29 14:52:53 2009 New Revision: 1406 Log: There is only one globally available cd_ctx, no need to pass pointers around. Modified: trunk/pisacd/cdctx.c trunk/pisacd/cdctx.h trunk/pisacd/cdmain.c Modified: trunk/pisacd/cdctx.c ============================================================================== --- trunk/pisacd/cdctx.c Thu Oct 29 14:48:43 2009 (r1405) +++ trunk/pisacd/cdctx.c Thu Oct 29 14:52:53 2009 (r1406) @@ -26,22 +26,22 @@ * @param cdctx cd_context structure to be initialized * @return none */ -void cdctx_init(cd_context *cdctx) +void cdctx_init(void) { - cdctx->flag_running = FALSE; - cdctx->flag_background = FALSE; - cdctx->flag_pending = 0; + cd_ctx.flag_running = FALSE; + cd_ctx.flag_background = FALSE; + cd_ctx.flag_pending = 0; - cdctx->fd_tunnel = -1; - cdctx->fd_control = -1; - cdctx->fd_data = -1; - cdctx->fd_pisaconf = -1; + cd_ctx.fd_tunnel = -1; + cd_ctx.fd_control = -1; + cd_ctx.fd_data = -1; + cd_ctx.fd_pisaconf = -1; - cdctx->ctrlhandlers = NULL; - cdctx->natlist = NULL; - cdctx->conlist = NULL; + cd_ctx.ctrlhandlers = NULL; + cd_ctx.natlist = NULL; + cd_ctx.conlist = NULL; - memset(&cdctx->scheduler, 0, sizeof(pisa_scheduler)); + memset(&cd_ctx.scheduler, 0, sizeof(pisa_scheduler)); } /** @@ -50,6 +50,6 @@ * @param cdctx cd_context structure to be destroyed * @return none */ -void cdctx_destroy(cd_context *cdctx) +void cdctx_destroy(void) { } Modified: trunk/pisacd/cdctx.h ============================================================================== --- trunk/pisacd/cdctx.h Thu Oct 29 14:48:43 2009 (r1405) +++ trunk/pisacd/cdctx.h Thu Oct 29 14:52:53 2009 (r1406) @@ -73,7 +73,7 @@ extern cd_context cd_ctx; -void cdctx_init(cd_context *cdctx); -void cdctx_destroy(cd_context *cdctx); +void cdctx_init(void); +void cdctx_destroy(void); #endif /* PISA_CDCTX_H */ Modified: trunk/pisacd/cdmain.c ============================================================================== --- trunk/pisacd/cdmain.c Thu Oct 29 14:48:43 2009 (r1405) +++ trunk/pisacd/cdmain.c Thu Oct 29 14:52:53 2009 (r1406) @@ -355,7 +355,7 @@ pisa_create_lock_file(PISACD_LOCK_FILE, 0); /* Set default values in context and config */ - cdctx_init(&cd_ctx); + cdctx_init(); cdconf_init(); /* Receive and parse command line arguments. @@ -434,7 +434,7 @@ pisa_tunnel_remove_firewall_rules(cd_ctx.ifname_tunnel); pisa_nat_destroy(cd_ctx.natlist); - cdctx_destroy(&cd_ctx); + cdctx_destroy(); cdconf_destroy(); pisa_arp_cleanup(); pisa_sched_cleanup(&cd_ctx.scheduler);