【发布时间】:2012-01-20 09:17:42
【问题描述】:
任何人都可以看到为什么以下 ifs,xv6-rev6 代码中的第 3279-3285 行, 使用:
int num;
num = proc−>tf−>eax;
if (num >= 0 && num < SYS_open && syscalls[num]) {
proc−>tf−>eax = syscalls[num]();
} else if (num >= SYS_open && num < NELEM(syscalls) && syscalls[num]) {
proc−>tf−>eax = syscalls[num]();
} else {...}
不仅仅是:
int num;
num = proc−>tf−>eax;
if (num >= 0 && num < NELEM(syscalls) && syscalls[num]) {
proc−>tf−>eax = syscalls[num]();
} else {...}
【问题讨论】:
-
if里面的两个语句可能曾经不同,但后来改变了。是否有可以检查文件的某种变更日志(例如 CVS/SVN/GIT 日志?)否则您必须询问开发人员。