Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 586510f

Browse files
committed
Improve coding style of new function.
1 parent 6b9d496 commit 586510f

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/port/fseeko.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.2 2002/10/23 21:16:17 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.3 2002/10/23 21:39:27 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -40,16 +40,10 @@ fseeko(FILE *stream, off_t offset, int whence)
4040
case SEEK_CUR:
4141
flockfile(stream);
4242
if (fgetpos(stream, &floc) != 0)
43-
{
44-
funlockfile(stream);
45-
return -1;
46-
}
43+
goto failure;
4744
floc += offset;
4845
if (fsetpos(stream, &floc) != 0)
49-
{
50-
funlockfile(stream);
51-
return -1;
52-
}
46+
goto failure;
5347
flockfile(stream);
5448
return 0;
5549
break;
@@ -61,23 +55,21 @@ fseeko(FILE *stream, off_t offset, int whence)
6155
case SEEK_END:
6256
flockfile(stream);
6357
if (fstat(fileno(stream), &filestat) != 0)
64-
{
65-
funlockfile(stream);
66-
return -1;
67-
}
58+
goto failure;
6859
floc = filestat.st_size;
6960
if (fsetpos(stream, &floc) != 0)
70-
{
71-
funlockfile(stream);
72-
return -1;
73-
}
61+
goto failure;
7462
funlockfile(stream);
7563
return 0;
7664
break;
7765
default:
7866
errno = EINVAL;
7967
return -1;
8068
}
69+
70+
failure:
71+
funlockfile(stream);
72+
return -1;
8173
}
8274

8375

0 commit comments

Comments
 (0)