git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] parse-options: remove OPT_BOOLEAN
@ 2013-12-07  5:02 Nguyễn Thái Ngọc Duy
  2013-12-08 22:23 ` Jonathan Nieder
  0 siblings, 1 reply; 2+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-12-07  5:02 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy

After a86a8b9 (sb/parseopt-boolean-removal), the deprecated
OPT_BOOLEAN is not used anywhere except by OPT__* macros. Kill
OPT_BOOLEAN and make OPT__* use OPT_COUNTUP directly instead. This
should stop OPT_BOOLEAN from entering the tree again in new patches.

OPT__DRY_RUN() is converted to use OPT_BOOL though because it does not
make sense to increase the level of dryness. All OPT__DRY_RUN call
sites have been checked and they look safe for OPT_BOOL.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 parse-options.h | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/parse-options.h b/parse-options.h
index 8736006..d670cb9 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -161,9 +161,6 @@ struct option {
 	  N_("no-op (backward compatibility)"),		\
 	  PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, parse_opt_noop_cb }
 
-/* Deprecated synonym */
-#define OPT_BOOLEAN OPT_COUNTUP
-
 /* parse_options() will filter out the processed options and leave the
  * non-option arguments in argv[]. usagestr strings should be marked
  * for translation with N_().
@@ -232,15 +229,15 @@ extern int parse_opt_tertiary(const struct option *, const char *, int);
 extern int parse_opt_string_list(const struct option *, const char *, int);
 extern int parse_opt_noop_cb(const struct option *, const char *, int);
 
-#define OPT__VERBOSE(var, h)  OPT_BOOLEAN('v', "verbose", (var), (h))
-#define OPT__QUIET(var, h)    OPT_BOOLEAN('q', "quiet",   (var), (h))
+#define OPT__VERBOSE(var, h)  OPT_COUNTUP('v', "verbose", (var), (h))
+#define OPT__QUIET(var, h)    OPT_COUNTUP('q', "quiet",   (var), (h))
 #define OPT__VERBOSITY(var) \
 	{ OPTION_CALLBACK, 'v', "verbose", (var), NULL, N_("be more verbose"), \
 	  PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }, \
 	{ OPTION_CALLBACK, 'q', "quiet", (var), NULL, N_("be more quiet"), \
 	  PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }
-#define OPT__DRY_RUN(var, h)  OPT_BOOLEAN('n', "dry-run", (var), (h))
-#define OPT__FORCE(var, h)    OPT_BOOLEAN('f', "force",   (var), (h))
+#define OPT__DRY_RUN(var, h)  OPT_BOOL('n', "dry-run", (var), (h))
+#define OPT__FORCE(var, h)    OPT_COUNTUP('f', "force",   (var), (h))
 #define OPT__ABBREV(var)  \
 	{ OPTION_CALLBACK, 0, "abbrev", (var), N_("n"),	\
 	  N_("use <n> digits to display SHA-1s"),	\
-- 
1.8.5.1.77.g42c48fa

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] parse-options: remove OPT_BOOLEAN
  2013-12-07  5:02 [PATCH] parse-options: remove OPT_BOOLEAN Nguyễn Thái Ngọc Duy
@ 2013-12-08 22:23 ` Jonathan Nieder
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Nieder @ 2013-12-08 22:23 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: git, Junio C Hamano, Stefan Beller

Hi,

Nguyễn Thái Ngọc Duy wrote:

> After a86a8b9 (sb/parseopt-boolean-removal), the deprecated
> OPT_BOOLEAN is not used anywhere except by OPT__* macros.

Yeah, I noticed the same thing too recently.

[...]
>                                              All OPT__DRY_RUN call
> sites have been checked and they look safe for OPT_BOOL.

This is the only functional change from the patch.  A repeated
--dry-run that behaves differently from --dry-run would be very weird,
and a quick check of OPT__DRY_RUN uses in pu confirms that with
current callers the patch is a no-op (except in the weird case that
someone overflows an "int" with a very long -nnnnnnn...  commandline).

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-08 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07  5:02 [PATCH] parse-options: remove OPT_BOOLEAN Nguyễn Thái Ngọc Duy
2013-12-08 22:23 ` Jonathan Nieder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).