{"thread":{"id":"35492","subject":"[PATCH] parse-options: remove OPT_BOOLEAN","startedAt":"2013-12-07T05:02:53Z","lastAt":"2013-12-08T22:23:52Z","messageCount":2,"participants":["Nguyễn Thái Ngọc Duy","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"231694","messageId":"1386392573-27367-1-git-send-email-pclouds@gmail.com","threadId":"35492","inReplyTo":null,"subject":"[PATCH] parse-options: remove OPT_BOOLEAN","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-12-07T05:02:53Z","receivedAt":"2013-12-07T05:02:53Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"After a86a8b9 (sb/parseopt-boolean-removal), the deprecated\nOPT_BOOLEAN is not used anywhere except by OPT__* macros. Kill\nOPT_BOOLEAN and make OPT__* use OPT_COUNTUP directly instead. This\nshould stop OPT_BOOLEAN from entering the tree again in new patches.\n\nOPT__DRY_RUN() is converted to use OPT_BOOL though because it does not\nmake sense to increase the level of dryness. All OPT__DRY_RUN call\nsites have been checked and they look safe for OPT_BOOL.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n parse-options.h | 11 ++++-------\n 1 file changed, 4 insertions(+), 7 deletions(-)\n\ndiff --git a/parse-options.h b/parse-options.h\nindex 8736006..d670cb9 100644\n--- a/parse-options.h\n+++ b/parse-options.h\n@@ -161,9 +161,6 @@ struct option {\n \t  N_(\"no-op (backward compatibility)\"),\t\t\\\n \t  PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, parse_opt_noop_cb }\n \n-/* Deprecated synonym */\n-#define OPT_BOOLEAN OPT_COUNTUP\n-\n /* parse_options() will filter out the processed options and leave the\n  * non-option arguments in argv[]. usagestr strings should be marked\n  * for translation with N_().\n@@ -232,15 +229,15 @@ extern int parse_opt_tertiary(const struct option *, const char *, int);\n extern int parse_opt_string_list(const struct option *, const char *, int);\n extern int parse_opt_noop_cb(const struct option *, const char *, int);\n \n-#define OPT__VERBOSE(var, h)  OPT_BOOLEAN('v', \"verbose\", (var), (h))\n-#define OPT__QUIET(var, h)    OPT_BOOLEAN('q', \"quiet\",   (var), (h))\n+#define OPT__VERBOSE(var, h)  OPT_COUNTUP('v', \"verbose\", (var), (h))\n+#define OPT__QUIET(var, h)    OPT_COUNTUP('q', \"quiet\",   (var), (h))\n #define OPT__VERBOSITY(var) \\\n \t{ OPTION_CALLBACK, 'v', \"verbose\", (var), NULL, N_(\"be more verbose\"), \\\n \t  PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }, \\\n \t{ OPTION_CALLBACK, 'q', \"quiet\", (var), NULL, N_(\"be more quiet\"), \\\n \t  PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }\n-#define OPT__DRY_RUN(var, h)  OPT_BOOLEAN('n', \"dry-run\", (var), (h))\n-#define OPT__FORCE(var, h)    OPT_BOOLEAN('f', \"force\",   (var), (h))\n+#define OPT__DRY_RUN(var, h)  OPT_BOOL('n', \"dry-run\", (var), (h))\n+#define OPT__FORCE(var, h)    OPT_COUNTUP('f', \"force\",   (var), (h))\n #define OPT__ABBREV(var)  \\\n \t{ OPTION_CALLBACK, 0, \"abbrev\", (var), N_(\"n\"),\t\\\n \t  N_(\"use <n> digits to display SHA-1s\"),\t\\\n-- \n1.8.5.1.77.g42c48fa\n"},{"id":"231771","messageId":"20131208222352.GA9108@google.com","threadId":"35492","inReplyTo":"1386392573-27367-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] parse-options: remove OPT_BOOLEAN","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-12-08T22:23:52Z","receivedAt":"2013-12-08T22:23:52Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nNguyễn Thái Ngọc Duy wrote:\n\n> After a86a8b9 (sb/parseopt-boolean-removal), the deprecated\n> OPT_BOOLEAN is not used anywhere except by OPT__* macros.\n\nYeah, I noticed the same thing too recently.\n\n[...]\n>                                              All OPT__DRY_RUN call\n> sites have been checked and they look safe for OPT_BOOL.\n\nThis is the only functional change from the patch.  A repeated\n--dry-run that behaves differently from --dry-run would be very weird,\nand a quick check of OPT__DRY_RUN uses in pu confirms that with\ncurrent callers the patch is a no-op (except in the weird case that\nsomeone overflows an \"int\" with a very long -nnnnnnn...  commandline).\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks.\n"}]}