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
658 */658 */
659struct defcmd_set {659struct defcmd_set {
660 int count;660 int count;
661 int usable;661 bool usable;
662 char *name;662 char *name;
663 char *usage;663 char *usage;
664 char *help;664 char *help;
@@ -666,7 +666,7 @@ struct defcmd_set { · 1 unmodified line
666};666};
667static struct defcmd_set *defcmd_set;667static struct defcmd_set *defcmd_set;
668static int defcmd_set_count;668static int defcmd_set_count;
669static int defcmd_in_progress;669static bool defcmd_in_progress;
670 670
671/* Forward references */671/* Forward references */
672static int kdb_exec_defcmd(int argc, const char **argv);672static 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
676 struct defcmd_set *s = defcmd_set + defcmd_set_count - 1;676 struct defcmd_set *s = defcmd_set + defcmd_set_count - 1;
677 char **save_command = s->command;677 char **save_command = s->command;
678 if (strcmp(argv0, "endefcmd") == 0) {678 if (strcmp(argv0, "endefcmd") == 0) {
679 defcmd_in_progress = 0;679 defcmd_in_progress = false;
680 if (!s->count)680 if (!s->count)
681 s->usable = 0;681 s->usable = false;
682 if (s->usable)682 if (s->usable)
683 /* macros are always safe because when executed each683 /* macros are always safe because when executed each
684 * internal command re-enters kdb_parse() and is684 * 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
695 if (!s->command) {695 if (!s->command) {
696 kdb_printf("Could not allocate new kdb_defcmd table for %s\n",696 kdb_printf("Could not allocate new kdb_defcmd table for %s\n",
697 cmdstr);697 cmdstr);
698 s->usable = 0;698 s->usable = false;
699 return KDB_NOTIMP;699 return KDB_NOTIMP;
700 }700 }
701 memcpy(s->command, save_command, s->count * sizeof(*(s->command)));701 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
737 defcmd_set_count * sizeof(*defcmd_set));737 defcmd_set_count * sizeof(*defcmd_set));
738 s = defcmd_set + defcmd_set_count;738 s = defcmd_set + defcmd_set_count;
739 memset(s, 0, sizeof(*s));739 memset(s, 0, sizeof(*s));
740 s->usable = 1;740 s->usable = true;
741 s->name = kdb_strdup(argv[1], GFP_KDB);741 s->name = kdb_strdup(argv[1], GFP_KDB);
742 if (!s->name)742 if (!s->name)
743 goto fail_name;743 goto fail_name;
@@ -756,7 +756,7 @@ static int kdb_defcmd(int argc, const char **argv) · 12 unmodified lines
756 s->help[strlen(s->help)-1] = '\0';756 s->help[strlen(s->help)-1] = '\0';
757 }757 }
758 ++defcmd_set_count;758 ++defcmd_set_count;
759 defcmd_in_progress = 1;759 defcmd_in_progress = true;
760 kfree(save_defcmd_set);760 kfree(save_defcmd_set);
761 return 0;761 return 0;
762fail_help:762fail_help: