forked from github/server
stackpointer bei reallocation neu setzen.
This commit is contained in:
parent
3d5c41a273
commit
b2404889d8
|
@ -52,8 +52,10 @@ opstack_push(opstack ** stackp, variant data)
|
||||||
*stackp = stack;
|
*stackp = stack;
|
||||||
}
|
}
|
||||||
if (stack->top - stack->begin == stack->size) {
|
if (stack->top - stack->begin == stack->size) {
|
||||||
|
int pos = stack->top - stack->begin;
|
||||||
stack->size += stack->size;
|
stack->size += stack->size;
|
||||||
stack->begin = realloc(stack->begin, sizeof(variant) * stack->size);
|
stack->begin = realloc(stack->begin, sizeof(variant) * stack->size);
|
||||||
|
stack->top = stack->begin + pos;
|
||||||
}
|
}
|
||||||
*stack->top++ = data;
|
*stack->top++ = data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue