1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-29 16:21:20 +03:00

Improve coding style of new function.

This commit is contained in:
Bruce Momjian 2002-10-23 21:39:27 +00:00
parent 6b9d496988
commit 586510f774

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.2 2002/10/23 21:16:17 momjian Exp $ * $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.3 2002/10/23 21:39:27 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -40,16 +40,10 @@ fseeko(FILE *stream, off_t offset, int whence)
case SEEK_CUR: case SEEK_CUR:
flockfile(stream); flockfile(stream);
if (fgetpos(stream, &floc) != 0) if (fgetpos(stream, &floc) != 0)
{ goto failure;
funlockfile(stream);
return -1;
}
floc += offset; floc += offset;
if (fsetpos(stream, &floc) != 0) if (fsetpos(stream, &floc) != 0)
{ goto failure;
funlockfile(stream);
return -1;
}
flockfile(stream); flockfile(stream);
return 0; return 0;
break; break;
@ -61,16 +55,10 @@ fseeko(FILE *stream, off_t offset, int whence)
case SEEK_END: case SEEK_END:
flockfile(stream); flockfile(stream);
if (fstat(fileno(stream), &filestat) != 0) if (fstat(fileno(stream), &filestat) != 0)
{ goto failure;
funlockfile(stream);
return -1;
}
floc = filestat.st_size; floc = filestat.st_size;
if (fsetpos(stream, &floc) != 0) if (fsetpos(stream, &floc) != 0)
{ goto failure;
funlockfile(stream);
return -1;
}
funlockfile(stream); funlockfile(stream);
return 0; return 0;
break; break;
@ -78,6 +66,10 @@ fseeko(FILE *stream, off_t offset, int whence)
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
failure:
funlockfile(stream);
return -1;
} }