16 lines
375 B
C
16 lines
375 B
C
|
#include <stdlib.h>
|
||
|
|
||
|
struct parser_state {
|
||
|
unsigned tmp_val;
|
||
|
unsigned* calorie_list;
|
||
|
size_t size;
|
||
|
};
|
||
|
|
||
|
void push_value(struct parser_state* state) {
|
||
|
// TODO(feliix42): error handling here?
|
||
|
state->calorie_list = realloc(state->calorie_list, state->size+1);
|
||
|
state->calorie_list[state->size] = state->tmp_val;
|
||
|
state->tmp_val = 0;
|
||
|
state->size++;
|
||
|
}
|