Replace some C99 style C with NuttX standard C89 style

This commit is contained in:
Gregory Nutt 2015-08-09 09:58:59 -06:00
parent d63ce7f5bb
commit 7c13bac893

View File

@ -404,8 +404,11 @@ FAR const struct extmatch_vtable_s *
ssize_t readline_common(FAR struct rl_common_s *vtbl, FAR char *buf, int buflen) ssize_t readline_common(FAR struct rl_common_s *vtbl, FAR char *buf, int buflen)
{ {
int escape; int escape;
int nch; int nch;
#ifdef CONFIG_READLINE_CMD_HISTORY
int i;
#endif
/* Sanity checks */ /* Sanity checks */
@ -524,7 +527,7 @@ ssize_t readline_common(FAR struct rl_common_s *vtbl, FAR char *buf, int buflen)
idx = idx - CONFIG_READLINE_CMD_HISTORY_LEN; idx = idx - CONFIG_READLINE_CMD_HISTORY_LEN;
} }
for (int i=0; g_cmd_history[idx][i] != '\0'; i++) for (i = 0; g_cmd_history[idx][i] != '\0'; i++)
{ {
buf[nch++] = g_cmd_history[idx][i]; buf[nch++] = g_cmd_history[idx][i];
RL_PUTC(vtbl, g_cmd_history[idx][i]); RL_PUTC(vtbl, g_cmd_history[idx][i]);
@ -606,11 +609,9 @@ ssize_t readline_common(FAR struct rl_common_s *vtbl, FAR char *buf, int buflen)
if (nch >= 1) if (nch >= 1)
{ {
int i = 0;
g_cmd_history_head = (g_cmd_history_head + 1) % CONFIG_READLINE_CMD_HISTORY_LEN; g_cmd_history_head = (g_cmd_history_head + 1) % CONFIG_READLINE_CMD_HISTORY_LEN;
for (i=0; (i < nch) && i < (CONFIG_READLINE_CMD_HISTORY_LINELEN - 1); i++) for (i = 0; (i < nch) && i < (CONFIG_READLINE_CMD_HISTORY_LINELEN - 1); i++)
{ {
g_cmd_history[g_cmd_history_head][i] = buf[i]; g_cmd_history[g_cmd_history_head][i] = buf[i];
} }