Introduced 4 macros to minimise boilerplate command line processing code.
Nicely cuts around 130 lines of code, spread over the core and several tools.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2422 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c
index 6d800de..4497b32 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -1601,16 +1601,8 @@
Bool SK_(process_cmd_line_option)(Char* arg)
{
- if (VG_CLO_STREQ(arg, "--avoid-strlen-errors=yes"))
- MC_(clo_avoid_strlen_errors) = True;
- else if (VG_CLO_STREQ(arg, "--avoid-strlen-errors=no"))
- MC_(clo_avoid_strlen_errors) = False;
-
- else if (VG_CLO_STREQ(arg, "--cleanup=yes"))
- MC_(clo_cleanup) = True;
- else if (VG_CLO_STREQ(arg, "--cleanup=no"))
- MC_(clo_cleanup) = False;
-
+ VG_BOOL_CLO("--avoid-strlen-errors", MC_(clo_avoid_strlen_errors))
+ else VG_BOOL_CLO("--cleanup", MC_(clo_cleanup))
else
return MAC_(process_common_cmd_line_option)(arg);