precalculate_sizes: don't malloc needlessly
This commit is contained in:
parent
7b9318a541
commit
ea43507bed
|
@ -183,8 +183,11 @@ free_params:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *precalculate_sizes(Con *con, render_params *p) {
|
static int *precalculate_sizes(Con *con, render_params *p) {
|
||||||
|
if ((con->layout != L_SPLITH && con->layout != L_SPLITV) || p->children <= 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int *sizes = smalloc(p->children * sizeof(int));
|
int *sizes = smalloc(p->children * sizeof(int));
|
||||||
if ((con->layout == L_SPLITH || con->layout == L_SPLITV) && p->children > 0) {
|
|
||||||
assert(!TAILQ_EMPTY(&con->nodes_head));
|
assert(!TAILQ_EMPTY(&con->nodes_head));
|
||||||
|
|
||||||
Con *child;
|
Con *child;
|
||||||
|
@ -204,7 +207,6 @@ static int *precalculate_sizes(Con *con, render_params *p) {
|
||||||
assigned += signal;
|
assigned += signal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return sizes;
|
return sizes;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue