6
mpc.c
6
mpc.c
@@ -3644,7 +3644,7 @@ static int mpc_nodecount_unretained(mpc_parser_t* p, int force) {
|
|||||||
if (p->type == MPC_TYPE_COUNT) { return 1 + mpc_nodecount_unretained(p->data.repeat.x, 0); }
|
if (p->type == MPC_TYPE_COUNT) { return 1 + mpc_nodecount_unretained(p->data.repeat.x, 0); }
|
||||||
|
|
||||||
if (p->type == MPC_TYPE_OR) {
|
if (p->type == MPC_TYPE_OR) {
|
||||||
total = 0;
|
total = 1;
|
||||||
for(i = 0; i < p->data.or.n; i++) {
|
for(i = 0; i < p->data.or.n; i++) {
|
||||||
total += mpc_nodecount_unretained(p->data.or.xs[i], 0);
|
total += mpc_nodecount_unretained(p->data.or.xs[i], 0);
|
||||||
}
|
}
|
||||||
@@ -3652,7 +3652,7 @@ static int mpc_nodecount_unretained(mpc_parser_t* p, int force) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p->type == MPC_TYPE_AND) {
|
if (p->type == MPC_TYPE_AND) {
|
||||||
total = 0;
|
total = 1;
|
||||||
for(i = 0; i < p->data.and.n; i++) {
|
for(i = 0; i < p->data.and.n; i++) {
|
||||||
total += mpc_nodecount_unretained(p->data.and.xs[i], 0);
|
total += mpc_nodecount_unretained(p->data.and.xs[i], 0);
|
||||||
}
|
}
|
||||||
@@ -3725,7 +3725,7 @@ static void mpc_optimise_unretained(mpc_parser_t *p, int force) {
|
|||||||
n = p->data.or.n; m = t->data.or.n;
|
n = p->data.or.n; m = t->data.or.n;
|
||||||
p->data.or.n = n + m - 1;
|
p->data.or.n = n + m - 1;
|
||||||
p->data.or.xs = realloc(p->data.or.xs, sizeof(mpc_parser_t*) * (n + m -1));
|
p->data.or.xs = realloc(p->data.or.xs, sizeof(mpc_parser_t*) * (n + m -1));
|
||||||
memmove(p->data.or.xs + m, t->data.or.xs + 1, n * sizeof(mpc_parser_t*));
|
memmove(p->data.or.xs + m, p->data.or.xs + 1, (n - 1) * sizeof(mpc_parser_t*));
|
||||||
memmove(p->data.or.xs, t->data.or.xs, m * sizeof(mpc_parser_t*));
|
memmove(p->data.or.xs, t->data.or.xs, m * sizeof(mpc_parser_t*));
|
||||||
free(t->data.or.xs); free(t->name); free(t);
|
free(t->data.or.xs); free(t->name); free(t);
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user