Let's use the idiomatic functions, eh?

That way the code is simpler and there aren't error messages scattered
all over the place.
This commit is contained in:
Simon Forman 2023-02-19 17:54:34 -08:00
parent f194df8159
commit f06c261e81
1 changed files with 4 additions and 8 deletions

View File

@ -294,17 +294,13 @@ void
fn(JoyListPtr stack, __attribute__((unused)) JoyListPtr expression)
{
JoyList s1 = pop_list(stack);
JoyListPtr s1Ptr = &s1;
mpz_t *i1 = pop_int(stack);
JoyList node = newIntNode();
mpz_set(node->head->value.i, *i1);
while (s1) {
if (joyInt == s1->head->kind) {
mpz_add(node->head->value.i, node->head->value.i, s1->head->value.i);
s1 = s1->tail;
} else {
fprintf(stderr, "Not an integer.\n");
longjmp(jbuf, 1);
}
while (*s1Ptr) {
i1 = pop_int(s1Ptr);
mpz_add(node->head->value.i, node->head->value.i, *i1);
}
node->tail = *stack;
*stack = node;