1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2025-01-18 21:31:06 +02:00

m1/perf/sched.c: use calloc instead of malloc plus memset

This commit is contained in:
Werner Almesberger 2011-09-26 16:51:37 -03:00
parent 5bf9ae002f
commit 0a7e5b1473

View File

@ -315,14 +315,12 @@ static void mark(int vm_reg)
static void init_registers(struct fpvm_fragment *frag,
unsigned int *registers)
{
size_t regs_size;
int i;
get_registers(frag, registers);
regs_size = sizeof(struct vm_reg)*(frag->nbindings-frag->next_sur);
sc->regs = malloc(regs_size);
memset(sc->regs, 0, regs_size);
sc->regs =
calloc(frag->nbindings-frag->next_sur, sizeof(struct vm_reg));
for (i = 0; i != frag->ninstructions; i++) {
mark(frag->code[i].opa);
@ -614,8 +612,7 @@ static int schedule(unsigned int *code)
static void init_scheduler_context(struct fpvm_fragment *frag,
unsigned int *reg)
{
sc = malloc(sizeof(*sc));
memset(sc, 0, sizeof(*sc));
sc = calloc(1, sizeof(*sc));
sc->frag = frag;