From dca5b5ca2e3687f27ebf589fe3855966932840d8 Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 10 Aug 2007 17:17:42 +0000 Subject: avoid assignments in declarations --- trap.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'trap.c') diff --git a/trap.c b/trap.c index 7a47516..ed66e99 100644 --- a/trap.c +++ b/trap.c @@ -30,9 +30,7 @@ idtinit(void) void trap(struct trapframe *tf) { - int v = tf->trapno; - - if(v == T_SYSCALL){ + if(tf->trapno == T_SYSCALL){ if(cp->killed) proc_exit(); cp->tf = tf; @@ -47,7 +45,7 @@ trap(struct trapframe *tf) // during interrupt handler. Decrement before returning. cpus[cpu()].nlock++; - switch(v){ + switch(tf->trapno){ case IRQ_OFFSET + IRQ_TIMER: lapic_timerintr(); cpus[cpu()].nlock--; @@ -82,12 +80,13 @@ trap(struct trapframe *tf) if(cp) { // Assume process divided by zero or dereferenced null, etc. cprintf("pid %d %s: unhandled trap %d on cpu %d eip %x -- kill proc\n", - cp->pid, cp->name, v, cpu(), tf->eip); + cp->pid, cp->name, tf->trapno, cpu(), tf->eip); proc_exit(); } // Otherwise it's our mistake. - cprintf("unexpected trap %d from cpu %d eip %x\n", v, cpu(), tf->eip); + cprintf("unexpected trap %d from cpu %d eip %x\n", + tf->trapno, cpu(), tf->eip); panic("trap"); } -- cgit v1.2.3