1
0
Fork 0
This commit is contained in:
dtb 2024-01-17 21:29:46 -07:00
parent 28c3448eda
commit d46a189914
1 changed files with 6 additions and 7 deletions

13
mm/mm.c
View File

@ -143,17 +143,16 @@ Io_fileindex(struct Io *io, FILE *f){
}
/* Returns the corresponding file name in the io struct to the FILE pointer f,
* or NULL if f isn't in io->files or io->ex->files. */
* or NULL if f is NULL or isn't in io->files or io->ex->files. */
static char *
Io_filename(struct Io *io, FILE *f){
int i;
if((i = Io_fileindex(io, f)) == -1)
return NULL;
else if(i < io->s - 1)
return io->names[i];
else
return io->ex->names[i - io->s];
return (f == NULL || (i = Io_fileindex(io, f)) == -1)
? NULL
: (i < io->s - 1)
? io->names[i]
: io->ex->names[i - io->s];
}
static struct Io *Io_fremove(struct Io *io, FILE *f);