mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2025-01-19 05:01:06 +02:00
m1/perf/sched.c: use calloc instead of malloc plus memset
This commit is contained in:
parent
5bf9ae002f
commit
0a7e5b1473
@ -315,14 +315,12 @@ static void mark(int vm_reg)
|
|||||||
static void init_registers(struct fpvm_fragment *frag,
|
static void init_registers(struct fpvm_fragment *frag,
|
||||||
unsigned int *registers)
|
unsigned int *registers)
|
||||||
{
|
{
|
||||||
size_t regs_size;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
get_registers(frag, registers);
|
get_registers(frag, registers);
|
||||||
|
|
||||||
regs_size = sizeof(struct vm_reg)*(frag->nbindings-frag->next_sur);
|
sc->regs =
|
||||||
sc->regs = malloc(regs_size);
|
calloc(frag->nbindings-frag->next_sur, sizeof(struct vm_reg));
|
||||||
memset(sc->regs, 0, regs_size);
|
|
||||||
|
|
||||||
for (i = 0; i != frag->ninstructions; i++) {
|
for (i = 0; i != frag->ninstructions; i++) {
|
||||||
mark(frag->code[i].opa);
|
mark(frag->code[i].opa);
|
||||||
@ -614,8 +612,7 @@ static int schedule(unsigned int *code)
|
|||||||
static void init_scheduler_context(struct fpvm_fragment *frag,
|
static void init_scheduler_context(struct fpvm_fragment *frag,
|
||||||
unsigned int *reg)
|
unsigned int *reg)
|
||||||
{
|
{
|
||||||
sc = malloc(sizeof(*sc));
|
sc = calloc(1, sizeof(*sc));
|
||||||
memset(sc, 0, sizeof(*sc));
|
|
||||||
|
|
||||||
sc->frag = frag;
|
sc->frag = frag;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user