Reinitialize memory pool on each loop of the REPL
This commit is contained in:
parent
e5cd69c26b
commit
ecd50c76c5
@ -19,7 +19,6 @@ static repl_t repl = {
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
init_repl(&repl);
|
|
||||||
run_repl(&repl);
|
run_repl(&repl);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ typedef struct {
|
|||||||
char result_buffer[REPL_RESULT_BUFFER_SIZE];
|
char result_buffer[REPL_RESULT_BUFFER_SIZE];
|
||||||
} repl_t;
|
} repl_t;
|
||||||
|
|
||||||
void init_repl(repl_t *repl);
|
|
||||||
bool step_repl(repl_t *repl);
|
bool step_repl(repl_t *repl);
|
||||||
void run_repl(repl_t *repl);
|
void run_repl(repl_t *repl);
|
||||||
|
|
||||||
|
@ -3,13 +3,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
void init_repl(repl_t *repl)
|
|
||||||
{
|
|
||||||
init_memory_pool(&repl->pool);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool step_repl(repl_t *repl)
|
bool step_repl(repl_t *repl)
|
||||||
{
|
{
|
||||||
|
init_memory_pool(&repl->pool);
|
||||||
|
|
||||||
int len;
|
int len;
|
||||||
for (len = 0; len < REPL_LINE_BUFFER_SIZE; ++len) {
|
for (len = 0; len < REPL_LINE_BUFFER_SIZE; ++len) {
|
||||||
const int byte = repl->get_byte();
|
const int byte = repl->get_byte();
|
||||||
|
@ -74,7 +74,6 @@ static void set_up_valid_state(void)
|
|||||||
input_len = 14;
|
input_len = 14;
|
||||||
read_result = &expression;
|
read_result = &expression;
|
||||||
evaluate_result = 4321;
|
evaluate_result = 4321;
|
||||||
init_repl(&repl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_is_called_on_first_line_line_in_input(void)
|
static void read_is_called_on_first_line_line_in_input(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user