Add find_line
This commit is contained in:
parent
88240dab06
commit
a31fde98e4
12
csim.c
12
csim.c
@ -197,6 +197,18 @@ void print_set(linked_line* line)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@returns the first line with a matching tag, the first invalid line,
|
||||
or the first line without an older (i.e. the end of the set
|
||||
*/
|
||||
linked_line* find_line(linked_line* line, long tag)
|
||||
{
|
||||
if(line->tag == tag || !line->validity || !line->older)
|
||||
return line;
|
||||
else
|
||||
return find_line(line->older, tag);
|
||||
}
|
||||
|
||||
void print_usage(void)
|
||||
{
|
||||
printf("Usage: ./csim [-hv] -s <number> -E <number> -b <number> -t <file>\n"
|
||||
|
Reference in New Issue
Block a user