aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Lisovskiy <lly.dev@gmail.com>2011-10-18 00:35:47 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-10-18 00:35:47 +0200
commit6c9c0a1dc9de48b59c103600a1f574a4a234b3d6 (patch)
treebc758b649ccccc95e4020431457362991155b1bd
parentcd06e06eee3ef89e45b60d7122e5518995c7f65e (diff)
downloadbusybox-w32-6c9c0a1dc9de48b59c103600a1f574a4a234b3d6.tar.gz
busybox-w32-6c9c0a1dc9de48b59c103600a1f574a4a234b3d6.tar.bz2
busybox-w32-6c9c0a1dc9de48b59c103600a1f574a4a234b3d6.zip
udhcp: IF_UDHCP_VERBOSE() macro - improve code readability
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/common.h2
-rw-r--r--networking/udhcp/dhcpc.c10
-rw-r--r--networking/udhcp/dhcpd.c4
3 files changed, 5 insertions, 11 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index 80d97e857..786266810 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -248,6 +248,7 @@ struct option_set *udhcp_find_option(struct option_set *opt_list, uint8_t code)
248/*** Logging ***/ 248/*** Logging ***/
249 249
250#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1 250#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1
251# define IF_UDHCP_VERBOSE(...) __VA_ARGS__
251extern unsigned dhcp_verbose; 252extern unsigned dhcp_verbose;
252# define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0) 253# define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0)
253# if CONFIG_UDHCP_DEBUG >= 2 254# if CONFIG_UDHCP_DEBUG >= 2
@@ -263,6 +264,7 @@ void udhcp_dump_packet(struct dhcp_packet *packet) FAST_FUNC;
263# define log3(...) ((void)0) 264# define log3(...) ((void)0)
264# endif 265# endif
265#else 266#else
267# define IF_UDHCP_VERBOSE(...)
266# define udhcp_dump_packet(...) ((void)0) 268# define udhcp_dump_packet(...) ((void)0)
267# define log1(...) ((void)0) 269# define log1(...) ((void)0)
268# define log2(...) ((void)0) 270# define log2(...) ((void)0)
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 3be09f4d7..29a6cd5a1 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1077,11 +1077,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1077 1077
1078 /* Parse command line */ 1078 /* Parse command line */
1079 /* O,x: list; -T,-t,-A take numeric param */ 1079 /* O,x: list; -T,-t,-A take numeric param */
1080 opt_complementary = "O::x::T+:t+:A+" 1080 opt_complementary = "O::x::T+:t+:A+" IF_UDHCP_VERBOSE(":vv") ;
1081#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1
1082 ":vv"
1083#endif
1084 ;
1085 IF_LONG_OPTS(applet_long_options = udhcpc_longopts;) 1081 IF_LONG_OPTS(applet_long_options = udhcpc_longopts;)
1086 opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fB" 1082 opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fB"
1087 USE_FOR_MMU("b") 1083 USE_FOR_MMU("b")
@@ -1095,9 +1091,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1095 , &list_O 1091 , &list_O
1096 , &list_x 1092 , &list_x
1097 IF_FEATURE_UDHCP_PORT(, &str_P) 1093 IF_FEATURE_UDHCP_PORT(, &str_P)
1098#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1 1094 IF_UDHCP_VERBOSE(, &dhcp_verbose)
1099 , &dhcp_verbose
1100#endif
1101 ); 1095 );
1102 if (opt & (OPT_h|OPT_H)) 1096 if (opt & (OPT_h|OPT_H))
1103 client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0); 1097 client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 747472d0c..dd55e70f4 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -314,9 +314,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
314#endif 314#endif
315 opt = getopt32(argv, "fSv" 315 opt = getopt32(argv, "fSv"
316 IF_FEATURE_UDHCP_PORT("P:", &str_P) 316 IF_FEATURE_UDHCP_PORT("P:", &str_P)
317#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1 317 IF_UDHCP_VERBOSE(, &dhcp_verbose)
318 , &dhcp_verbose
319#endif
320 ); 318 );
321 if (!(opt & 1)) { /* no -f */ 319 if (!(opt & 1)) { /* no -f */
322 bb_daemonize_or_rexec(0, argv); 320 bb_daemonize_or_rexec(0, argv);