wmppp.app: Switch ifs to #ifs for macros.

Fixes "warning: null argument where non-null required" compiler warnings by
not passing NULL to strdup and "(warning) Conversion of string literal to
bool always evaluates to true" found by cppcheck.
This commit is contained in:
Doug Torrance 2015-05-19 22:30:59 -05:00 committed by Carlos R. Mafra
parent 8d3011886d
commit 82aceda014

View file

@ -187,10 +187,11 @@
/* Defines */
/***********/
#define START_ACTION (NULL)
#define STOP_ACTION (NULL)
#define SPEED_ACTION (NULL)
#define IFDOWN_ACTION (NULL)
/* Fill in and uncomment the hardcoded actions. */
/* #define START_ACTION (NULL) */
/* #define STOP_ACTION (NULL) */
/* #define SPEED_ACTION (NULL) */
/* #define IFDOWN_ACTION (NULL) */
#define STAMP_FILE_PRE "/var/run/wmppp."
@ -408,14 +409,22 @@ void wmppp_routine(int argc, char **argv) {
get_statistics(active_interface, &ppp_rl, &ppp_sl, &ppp_orbytes, &ppp_osbytes);
/* Scan through ~/.wmifsrc for the mouse button actions. */
if (START_ACTION) start_action = strdup(START_ACTION);
if (STOP_ACTION) stop_action = strdup(STOP_ACTION);
if (SPEED_ACTION) speed_action = strdup(SPEED_ACTION);
if (IFDOWN_ACTION) ifdown_action = strdup(IFDOWN_ACTION);
if (STAMP_FILE_PRE) {
#ifdef START_ACTION
start_action = strdup(START_ACTION);
#endif
#ifdef STOP_ACTION
stop_action = strdup(STOP_ACTION);
#endif
#ifdef SPEED_ACTION
speed_action = strdup(SPEED_ACTION);
#endif
#ifdef IFDOWN_ACTION
ifdown_action = strdup(IFDOWN_ACTION);
#endif
#ifdef STAMP_FILE_PRE
sprintf (temp, "%s%s", STAMP_FILE_PRE, active_interface);
stamp_file = strdup (temp);
}
#endif
strcpy(temp, "/etc/wmppprc");