Skip to content

Commit a92331d

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 46273df commit a92331d

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

builtin/log.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -764,24 +764,28 @@ static void add_header(const char *value)
764764
item->string[len] = '\0';
765765
}
766766

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;
770781
static int do_signoff;
771782
static int base_auto;
772783
static char *from;
773784
static const char *signature = git_version_string;
774785
static const char *signature_file;
775-
static int config_cover_letter;
786+
static enum cover_setting config_cover_letter;
776787
static const char *config_output_directory;
777788

778-
enum {
779-
COVER_UNSET,
780-
COVER_OFF,
781-
COVER_ON,
782-
COVER_AUTO
783-
};
784-
785789
static int git_format_config(const char *var, const char *value, void *cb)
786790
{
787791
struct rev_info *rev = cb;
@@ -1248,9 +1252,9 @@ static int output_directory_callback(const struct option *opt, const char *arg,
12481252

12491253
static int thread_callback(const struct option *opt, const char *arg, int unset)
12501254
{
1251-
int *thread = (int *)opt->value;
1255+
enum thread_level *thread = (enum thread_level *)opt->value;
12521256
if (unset)
1253-
*thread = 0;
1257+
*thread = THREAD_UNSET;
12541258
else if (!arg || !strcmp(arg, "shallow"))
12551259
*thread = THREAD_SHALLOW;
12561260
else if (!strcmp(arg, "deep"))

0 commit comments

Comments
 (0)