[pisa-src] r1682 - trunk/pisasd/sdconf.c

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Fri, 13 Nov 2009 12:30:59 +0100

Author: tjansen
Date: Fri Nov 13 12:30:59 2009
New Revision: 1682

Log:
Instead of memsetting every member of the structure by hand memset the whole
structure. Accidentially forgetting to initialize a new variable won't hurt
this way.

Modified:
   trunk/pisasd/sdconf.c

Modified: trunk/pisasd/sdconf.c
==============================================================================
--- trunk/pisasd/sdconf.c       Fri Nov 13 12:18:04 2009        (r1681)
+++ trunk/pisasd/sdconf.c       Fri Nov 13 12:30:59 2009        (r1682)
@@ -27,6 +27,7 @@
  */
 sd_conf sd_cfg;
 
+/* TODO: get rid of global variables in libpisa, this is one of them. */
 extern char authorized_cfg_file[MAX_PATH+1]; /* in libpisa/config.c */
 
 /**
@@ -34,22 +35,8 @@
  */
 void sdconf_init(void)
 {
-       memset(sd_cfg.conffile, 0, sizeof(sd_cfg.conffile));
-       memset(sd_cfg.debuglevel, 0, sizeof(sd_cfg.debuglevel));
-       memset(sd_cfg.ifname_eth, 0, sizeof(sd_cfg.ifname_eth));
-       memset(&sd_cfg.ipaddr, 0, sizeof(sd_cfg.ipaddr));
-       memset(&sd_cfg.dyn_min, 0, sizeof(sd_cfg.dyn_min));
-       memset(&sd_cfg.dyn_max, 0, sizeof(sd_cfg.dyn_max));
-       memset(&sd_cfg.dyn_mask, 0, sizeof(sd_cfg.dyn_mask));
-
+       memset(&sd_cfg, 0, sizeof(&sd_cfg));
        memset(authorized_cfg_file, 0, sizeof(authorized_cfg_file));
-
-       sd_cfg.port_control = 0;
-       sd_cfg.port_data = 0;
-       sd_cfg.is_relay = 0;
-
-       memset(&sd_cfg.nat_up, 0, sizeof(sd_cfg.nat_up));
-       memset(&sd_cfg.nat_down, 0, sizeof(sd_cfg.nat_down));
 }
 
 /**

Other related posts:

  • » [pisa-src] r1682 - trunk/pisasd/sdconf.c - Thomas Jansen