Merge branch 'master'

This commit is contained in:
Laila van Reenen 2024-04-13 23:53:29 +02:00
commit 3b3761faa9
3 changed files with 11 additions and 5 deletions

View File

@ -78,7 +78,8 @@ char* fifoToString(FIFOBuffChar_t* fifo)
char* out = malloc(fifo->size + 1); char* out = malloc(fifo->size + 1);
char* write_p = out; char* write_p = out;
for (int i = fifo->size; i > 0; i--) int i;
for (i = fifo->size; i > 0; i--)
{ {
FIFOBuffChar_get(fifo, write_p); FIFOBuffChar_get(fifo, write_p);
write_p++; write_p++;
@ -111,6 +112,7 @@ void CLI_PrintHistory()
void historyPrevius() void historyPrevius()
{ {
char* line; char* line;
int i;
if ( if (
(History_getCurrPos(History) == History_getSize(History)) (History_getCurrPos(History) == History_getSize(History))
&& (FIFOBuffChar_getSize(FIFO) > 0) && (FIFOBuffChar_getSize(FIFO) > 0)
@ -119,7 +121,7 @@ void historyPrevius()
// add current text to end of history // add current text to end of history
line = fifoToString(FIFO); line = fifoToString(FIFO);
History_put(History, line); History_put(History, line);
for (int i=0; *(line + i) != '\0'; i++) for (i=0; *(line + i) != '\0'; i++)
{ {
CLI_stringOut((char*)"\x1b[D \x1b[D"); CLI_stringOut((char*)"\x1b[D \x1b[D");
} }
@ -139,7 +141,7 @@ void historyPrevius()
// write line // write line
if ((ret >= 0) && (line != NULL)) if ((ret >= 0) && (line != NULL))
{ {
for (int i=0; *(line + i) != '\0'; i++) for (i=0; *(line + i) != '\0'; i++)
{ {
CLI_charIn(*(line + i)); CLI_charIn(*(line + i));
} }
@ -161,7 +163,8 @@ void historyNext()
// write line // write line
if ((ret >= 0) && (line != NULL)) if ((ret >= 0) && (line != NULL))
{ {
for (int i=0; *(line + i) != '\0'; i++) int i;
for (i=0; *(line + i) != '\0'; i++)
{ {
CLI_charIn(*(line + i)); CLI_charIn(*(line + i));
} }

View File

@ -19,7 +19,8 @@ int CMDList_deinit(CMDList_t *list)
{ {
CMDList_t** list_p = (CMDList_t**)list; CMDList_t** list_p = (CMDList_t**)list;
for (int i = 0; i < 26; i++) int i;
for (i = 0; i < 26; i++)
{ {
if (*(list_p + i) != NULL) if (*(list_p + i) != NULL)
{ {

View File

@ -141,6 +141,7 @@ bool FIFOBuffChar_pop(FIFOBuffChar_t *fifo)
default: // buffer is at least 2 element big default: // buffer is at least 2 element big
// find the second last element // find the second last element
{
FIFOBuffChar_element_t* secondLastEl = fifo->FirstEl_p; FIFOBuffChar_element_t* secondLastEl = fifo->FirstEl_p;
while ( while (
secondLastEl->nextElement != fifo->LastEl_p secondLastEl->nextElement != fifo->LastEl_p
@ -159,6 +160,7 @@ bool FIFOBuffChar_pop(FIFOBuffChar_t *fifo)
ok = true; ok = true;
break; break;
} }
}
return ok; return ok;
} }