Skip to content

Commit 7faedcd

Browse files
Nicholas Mc GuireDaniel Thompson
authored andcommitted
kdb: use bool for binary state indicators
defcmd_in_progress is the state trace for command group processing - within a command group or not - usable is an indicator if a command set is valid (allocated/non-empty) - so use a bool for those binary indication here. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
1 parent 162bc7f commit 7faedcd

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

kernel/debug/kdb/kdb_main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,15 @@ static void kdb_cmderror(int diag)
658658
*/
659659
struct defcmd_set {
660660
int count;
661-
int usable;
661+
bool usable;
662662
char *name;
663663
char *usage;
664664
char *help;
665665
char **command;
666666
};
667667
static struct defcmd_set *defcmd_set;
668668
static int defcmd_set_count;
669-
static int defcmd_in_progress;
669+
static bool defcmd_in_progress;
670670

671671
/* Forward references */
672672
static int kdb_exec_defcmd(int argc, const char **argv);
@@ -676,9 +676,9 @@ static int kdb_defcmd2(const char *cmdstr, const char *argv0)
676676
struct defcmd_set *s = defcmd_set + defcmd_set_count - 1;
677677
char **save_command = s->command;
678678
if (strcmp(argv0, "endefcmd") == 0) {
679-
defcmd_in_progress = 0;
679+
defcmd_in_progress = false;
680680
if (!s->count)
681-
s->usable = 0;
681+
s->usable = false;
682682
if (s->usable)
683683
/* macros are always safe because when executed each
684684
* internal command re-enters kdb_parse() and is
@@ -695,7 +695,7 @@ static int kdb_defcmd2(const char *cmdstr, const char *argv0)
695695
if (!s->command) {
696696
kdb_printf("Could not allocate new kdb_defcmd table for %s\n",
697697
cmdstr);
698-
s->usable = 0;
698+
s->usable = false;
699699
return KDB_NOTIMP;
700700
}
701701
memcpy(s->command, save_command, s->count * sizeof(*(s->command)));
@@ -737,7 +737,7 @@ static int kdb_defcmd(int argc, const char **argv)
737737
defcmd_set_count * sizeof(*defcmd_set));
738738
s = defcmd_set + defcmd_set_count;
739739
memset(s, 0, sizeof(*s));
740-
s->usable = 1;
740+
s->usable = true;
741741
s->name = kdb_strdup(argv[1], GFP_KDB);
742742
if (!s->name)
743743
goto fail_name;
@@ -756,7 +756,7 @@ static int kdb_defcmd(int argc, const char **argv)
756756
s->help[strlen(s->help)-1] = '\0';
757757
}
758758
++defcmd_set_count;
759-
defcmd_in_progress = 1;
759+
defcmd_in_progress = true;
760760
kfree(save_defcmd_set);
761761
return 0;
762762
fail_help:

0 commit comments

Comments
 (0)