函数int_load_binary
中有如下代码
/* Read inherit names and find prog. Check mod times also. */
for (i = 0; i < (int) p->num_inherited; i++) {
fread((char *) &len, sizeof len, 1, f);
ALLOC_BUF(len + 1);
fread(buf, sizeof(char), len, f);
buf[len] = '\0';
/*
* Check times against inherited source. If saved binary of
* inherited prog exists, check against it also.
*/
sprintf(file_name_two, "%s/%s", SAVE_BINARIES, buf);
if (file_name_two[0] == '/')
file_name_two++;
len = strlen(file_name_two);
file_name_two[len - 1] = 'b';
if (src_flag &&
(check_times(mtime, buf) <= 0 ||
check_times(mtime, file_name_two) == 0)) { /* ok if -1 */
if (comp_flag)
debug_message("out of date (inherited source newer).\n");
fclose(f);
free_string(p->name);
FREE(p);
FREE(buf);
return OUT_OF_DATE;
}
/* find inherited program (maybe load it here?) */
ob = find_object2(buf);
if (!ob) {
if (comp_flag)
debug_message("missing inherited prog.\n");
fclose(f);
free_string(p->name);
FREE(p);
inherit_file = buf; /* freed elsewhere */
return 0;
}
// last modified by soso on 2010-06-21 for binaries support
p->inherit->prog = ob->prog;
}
请问为什么写成p->inherit->prog = ob->prog;
难道不应该写成p->inherit[i]->prog = ob->prog;吗?