format-patch: use enum variables

Before, `thread` and `config_cover_letter` were defined as ints even though they behaved as enums. Define actual enums and change these variables to use these new definitions. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Oct 15, 2019 at 02:06 UTC a92331df18112199d6aa7bee132ecf928509621c
1 file changed +17 -13
builtin/log.c
+17 -13
@@ -764,24 +764,28 @@ static void add_header(const char *value)
764 item->string[len] = '\0';
765 }
766
767 -#define THREAD_SHALLOW 1
768 -#define THREAD_DEEP 2
769 -static int thread;
767 +enum cover_setting {
768 + COVER_UNSET,
769 + COVER_OFF,
770 + COVER_ON,
771 + COVER_AUTO
772 +};
773 +
774 +enum thread_level {
775 + THREAD_UNSET,
776 + THREAD_SHALLOW,
777 + THREAD_DEEP
778 +};
779 +
780 +static enum thread_level thread;
781 static int do_signoff;
782 static int base_auto;
783 static char *from;
784 static const char *signature = git_version_string;
785 static const char *signature_file;
775 -static int config_cover_letter;
786 +static enum cover_setting config_cover_letter;
787 static const char *config_output_directory;
788
778 -enum {
779 - COVER_UNSET,
780 - COVER_OFF,
781 - COVER_ON,
782 - COVER_AUTO
783 -};
784 -
789 static int git_format_config(const char *var, const char *value, void *cb)
790 {
791 struct rev_info *rev = cb;
@@ -1248,9 +1252,9 @@ static int output_directory_callback(const struct option *opt, const char *arg,
1252
1253 static int thread_callback(const struct option *opt, const char *arg, int unset)
1254 {
1251 - int *thread = (int *)opt->value;
1255 + enum thread_level *thread = (enum thread_level *)opt->value;
1256 if (unset)
1253 - *thread = 0;
1257 + *thread = THREAD_UNSET;
1258 else if (!arg || !strcmp(arg, "shallow"))
1259 *thread = THREAD_SHALLOW;
1260 else if (!strcmp(arg, "deep"))