History

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.

Nicholas Mc Guire committed 8 years ago

Commit 7faedcd1 parent 162bc7f1 file · +7 −7Browse files

Unified · Split

kernel/debug/kdb/kdb_main.c+7−7
@@ -658,7 +658,7 @@ static void kdb_cmderror(int diag) · 657 unmodified lines
658658 */
659659 struct defcmd_set {
660660 int count;
661− int usable;
661+ bool usable;
662662 char *name;
663663 char *usage;
664664 char *help;
@@ -666,7 +666,7 @@ struct defcmd_set { · 1 unmodified line
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) · 3 unmodified lines
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) · 10 unmodified lines
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) · 35 unmodified lines
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) · 12 unmodified lines
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: