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>
This commit is contained in:
parent
162bc7f5af
commit
7faedcd4de
|
@ -658,7 +658,7 @@ static void kdb_cmderror(int diag)
|
||||||
*/
|
*/
|
||||||
struct defcmd_set {
|
struct defcmd_set {
|
||||||
int count;
|
int count;
|
||||||
int usable;
|
bool usable;
|
||||||
char *name;
|
char *name;
|
||||||
char *usage;
|
char *usage;
|
||||||
char *help;
|
char *help;
|
||||||
|
@ -666,7 +666,7 @@ struct defcmd_set {
|
||||||
};
|
};
|
||||||
static struct defcmd_set *defcmd_set;
|
static struct defcmd_set *defcmd_set;
|
||||||
static int defcmd_set_count;
|
static int defcmd_set_count;
|
||||||
static int defcmd_in_progress;
|
static bool defcmd_in_progress;
|
||||||
|
|
||||||
/* Forward references */
|
/* Forward references */
|
||||||
static int kdb_exec_defcmd(int argc, const char **argv);
|
static int kdb_exec_defcmd(int argc, const char **argv);
|
||||||
|
@ -676,9 +676,9 @@ static int kdb_defcmd2(const char *cmdstr, const char *argv0)
|
||||||
struct defcmd_set *s = defcmd_set + defcmd_set_count - 1;
|
struct defcmd_set *s = defcmd_set + defcmd_set_count - 1;
|
||||||
char **save_command = s->command;
|
char **save_command = s->command;
|
||||||
if (strcmp(argv0, "endefcmd") == 0) {
|
if (strcmp(argv0, "endefcmd") == 0) {
|
||||||
defcmd_in_progress = 0;
|
defcmd_in_progress = false;
|
||||||
if (!s->count)
|
if (!s->count)
|
||||||
s->usable = 0;
|
s->usable = false;
|
||||||
if (s->usable)
|
if (s->usable)
|
||||||
/* macros are always safe because when executed each
|
/* macros are always safe because when executed each
|
||||||
* internal command re-enters kdb_parse() and is
|
* internal command re-enters kdb_parse() and is
|
||||||
|
@ -695,7 +695,7 @@ static int kdb_defcmd2(const char *cmdstr, const char *argv0)
|
||||||
if (!s->command) {
|
if (!s->command) {
|
||||||
kdb_printf("Could not allocate new kdb_defcmd table for %s\n",
|
kdb_printf("Could not allocate new kdb_defcmd table for %s\n",
|
||||||
cmdstr);
|
cmdstr);
|
||||||
s->usable = 0;
|
s->usable = false;
|
||||||
return KDB_NOTIMP;
|
return KDB_NOTIMP;
|
||||||
}
|
}
|
||||||
memcpy(s->command, save_command, s->count * sizeof(*(s->command)));
|
memcpy(s->command, save_command, s->count * sizeof(*(s->command)));
|
||||||
|
@ -737,7 +737,7 @@ static int kdb_defcmd(int argc, const char **argv)
|
||||||
defcmd_set_count * sizeof(*defcmd_set));
|
defcmd_set_count * sizeof(*defcmd_set));
|
||||||
s = defcmd_set + defcmd_set_count;
|
s = defcmd_set + defcmd_set_count;
|
||||||
memset(s, 0, sizeof(*s));
|
memset(s, 0, sizeof(*s));
|
||||||
s->usable = 1;
|
s->usable = true;
|
||||||
s->name = kdb_strdup(argv[1], GFP_KDB);
|
s->name = kdb_strdup(argv[1], GFP_KDB);
|
||||||
if (!s->name)
|
if (!s->name)
|
||||||
goto fail_name;
|
goto fail_name;
|
||||||
|
@ -756,7 +756,7 @@ static int kdb_defcmd(int argc, const char **argv)
|
||||||
s->help[strlen(s->help)-1] = '\0';
|
s->help[strlen(s->help)-1] = '\0';
|
||||||
}
|
}
|
||||||
++defcmd_set_count;
|
++defcmd_set_count;
|
||||||
defcmd_in_progress = 1;
|
defcmd_in_progress = true;
|
||||||
kfree(save_defcmd_set);
|
kfree(save_defcmd_set);
|
||||||
return 0;
|
return 0;
|
||||||
fail_help:
|
fail_help:
|
||||||
|
|
Loading…
Reference in New Issue