mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
cli: Drop some #ifdefs in cli_readline
Add a few static inlines to avoid the need for #ifdefs in cli_readline_into_buffer() Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
33eb0b9eef
commit
039f8cc375
1 changed files with 14 additions and 6 deletions
|
@ -423,6 +423,18 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* !CONFIG_CMDLINE_EDITING */
|
||||||
|
|
||||||
|
static inline void hist_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cread_line(const char *const prompt, char *buf, unsigned int *len,
|
||||||
|
int timeout)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_CMDLINE_EDITING */
|
#endif /* CONFIG_CMDLINE_EDITING */
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
@ -552,8 +564,7 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer,
|
||||||
int timeout)
|
int timeout)
|
||||||
{
|
{
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
#ifdef CONFIG_CMDLINE_EDITING
|
uint len = CONFIG_SYS_CBSIZE;
|
||||||
unsigned int len = CONFIG_SYS_CBSIZE;
|
|
||||||
int rc;
|
int rc;
|
||||||
static int initted;
|
static int initted;
|
||||||
|
|
||||||
|
@ -563,7 +574,7 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer,
|
||||||
* Revert to non-history version if still
|
* Revert to non-history version if still
|
||||||
* running from flash.
|
* running from flash.
|
||||||
*/
|
*/
|
||||||
if (gd->flags & GD_FLG_RELOC) {
|
if (IS_ENABLED(CONFIG_CMDLINE_EDITING) && (gd->flags & GD_FLG_RELOC)) {
|
||||||
if (!initted) {
|
if (!initted) {
|
||||||
hist_init();
|
hist_init();
|
||||||
initted = 1;
|
initted = 1;
|
||||||
|
@ -576,9 +587,6 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer,
|
||||||
return rc < 0 ? rc : len;
|
return rc < 0 ? rc : len;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#endif /* CONFIG_CMDLINE_EDITING */
|
|
||||||
return cread_line_simple(prompt, p);
|
return cread_line_simple(prompt, p);
|
||||||
#ifdef CONFIG_CMDLINE_EDITING
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue