Author: tjansen Date: Thu Oct 29 14:56:24 2009 New Revision: 1407 Log: There is only one globally available sd_ctx, no need to pass pointers around. Modified: trunk/pisasd/sdctx.c trunk/pisasd/sdctx.h trunk/pisasd/sdmain.c Modified: trunk/pisasd/sdctx.c ============================================================================== --- trunk/pisasd/sdctx.c Thu Oct 29 14:52:53 2009 (r1406) +++ trunk/pisasd/sdctx.c Thu Oct 29 14:56:24 2009 (r1407) @@ -22,36 +22,30 @@ /** * Initialize general context of server daemon. - * - * @param sdctx sd_ctx structure to be initialized - * @return none */ -void sdctx_init(sd_context *sdctx) +void sdctx_init(void) { - sdctx->flag_running = FALSE; - sdctx->flag_background = FALSE; + sd_ctx.flag_running = FALSE; + sd_ctx.flag_background = FALSE; - sdctx->fd_control = -1; - sdctx->fd_data = -1; - sdctx->fd_tunnel= -1; - sdctx->fd_pisaconf = -1; - - sdctx->tunnel_device_name[0] = 0; - - sdctx->ctrlhandlers = NULL; - sdctx->natlist = NULL; - sdctx->conlist = NULL; - sdctx->disable_ip4_forward=0; + sd_ctx.fd_control = -1; + sd_ctx.fd_data = -1; + sd_ctx.fd_tunnel= -1; + sd_ctx.fd_pisaconf = -1; + + sd_ctx.tunnel_device_name[0] = 0; + + sd_ctx.ctrlhandlers = NULL; + sd_ctx.natlist = NULL; + sd_ctx.conlist = NULL; + sd_ctx.disable_ip4_forward=0; - memset(&sdctx->scheduler, 0, sizeof(pisa_scheduler)); + memset(&sd_ctx.scheduler, 0, sizeof(pisa_scheduler)); } /** * Destroy general context of server daemon. - * - * @param sdctx sd_ctx structure to be destroyed - * @return none */ -void sdctx_destroy(sd_context *sdctx) +void sdctx_destroy(void) { } Modified: trunk/pisasd/sdctx.h ============================================================================== --- trunk/pisasd/sdctx.h Thu Oct 29 14:52:53 2009 (r1406) +++ trunk/pisasd/sdctx.h Thu Oct 29 14:56:24 2009 (r1407) @@ -73,7 +73,7 @@ extern sd_context sd_ctx; -void sdctx_init(sd_context *sdctx); -void sdctx_destroy(sd_context *sdctx); +void sdctx_init(void); +void sdctx_destroy(void); #endif /* PISA_SDCTX_H */ Modified: trunk/pisasd/sdmain.c ============================================================================== --- trunk/pisasd/sdmain.c Thu Oct 29 14:52:53 2009 (r1406) +++ trunk/pisasd/sdmain.c Thu Oct 29 14:56:24 2009 (r1407) @@ -369,7 +369,7 @@ pisa_create_lock_file(PISASD_LOCK_FILE, 0); /* Set default values in context and config */ - sdctx_init(&sd_ctx); + sdctx_init(); sdconf_init(&sd_cfg); /* Receive and parse command line arguments. @@ -466,7 +466,7 @@ if (sd_cfg.is_relay == 1) pisa_sdnat_stop(); - sdctx_destroy(&sd_ctx); + sdctx_destroy(); sdconf_destroy(&sd_cfg); pisa_arp_cleanup();