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:
parent
f194df8159
commit
f06c261e81
|
|
@ -294,17 +294,13 @@ void
|
||||||
fn(JoyListPtr stack, __attribute__((unused)) JoyListPtr expression)
|
fn(JoyListPtr stack, __attribute__((unused)) JoyListPtr expression)
|
||||||
{
|
{
|
||||||
JoyList s1 = pop_list(stack);
|
JoyList s1 = pop_list(stack);
|
||||||
|
JoyListPtr s1Ptr = &s1;
|
||||||
mpz_t *i1 = pop_int(stack);
|
mpz_t *i1 = pop_int(stack);
|
||||||
JoyList node = newIntNode();
|
JoyList node = newIntNode();
|
||||||
mpz_set(node->head->value.i, *i1);
|
mpz_set(node->head->value.i, *i1);
|
||||||
while (s1) {
|
while (*s1Ptr) {
|
||||||
if (joyInt == s1->head->kind) {
|
i1 = pop_int(s1Ptr);
|
||||||
mpz_add(node->head->value.i, node->head->value.i, s1->head->value.i);
|
mpz_add(node->head->value.i, node->head->value.i, *i1);
|
||||||
s1 = s1->tail;
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Not an integer.\n");
|
|
||||||
longjmp(jbuf, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
node->tail = *stack;
|
node->tail = *stack;
|
||||||
*stack = node;
|
*stack = node;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue