Skip to content

Commit ca08ce2

Browse files
committed
Clean up uninitialized-variable warning from egcs.
(Curious that gcc doesn't complain about this code...).
1 parent 3257b0e commit ca08ce2

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/bin/psql/psql.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.180 1999/05/26 20:08:06 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.181 1999/05/30 15:32:45 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -3118,7 +3118,7 @@ handleCopyIn(PGconn *conn, const bool mustprompt, FILE *copystream)
31183118
char copybuf[COPYBUFSIZ];
31193119
char *s;
31203120
int buflen;
3121-
int c;
3121+
int c = 0;
31223122

31233123
if (mustprompt)
31243124
{
@@ -3138,18 +3138,23 @@ handleCopyIn(PGconn *conn, const bool mustprompt, FILE *copystream)
31383138
while (!linedone)
31393139
{ /* for each buffer ... */
31403140
s = copybuf;
3141-
buflen = COPYBUFSIZ;
3142-
for (; buflen > 1 &&
3143-
!(linedone = (c = getc(copystream)) == '\n' || c == EOF);
3144-
--buflen)
3141+
for (buflen = COPYBUFSIZ; buflen > 1; buflen--)
3142+
{
3143+
c = getc(copystream);
3144+
if (c == '\n' || c == EOF)
3145+
{
3146+
linedone = true;
3147+
break;
3148+
}
31453149
*s++ = c;
3150+
}
3151+
*s = '\0';
31463152
if (c == EOF)
31473153
{
31483154
PQputline(conn, "\\.");
31493155
copydone = true;
31503156
break;
31513157
}
3152-
*s = '\0';
31533158
PQputline(conn, copybuf);
31543159
if (firstload)
31553160
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy