8000 Fix quotes in /* */ comments in psql. · postgrespro/postgres_cluster@c9ec78a · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c9ec78a

Browse files
committed
Fix quotes in /* */ comments in psql.
1 parent 43ba1b4 commit c9ec78a

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

src/bin/psql/mainloop.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.30 2000/05/12 16:13:44 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.31 2000/06/29 16:27:57 momjian Exp $
77
*/
88
#include "postgres.h"
99
#include "mainloop.h"
@@ -18,9 +18,7 @@
1818

1919
#ifndef WIN32
2020
#include <setjmp.h>
21-
2221
sigjmp_buf main_loop_jmp;
23-
2422
#endif
2523

2624

@@ -298,18 +296,13 @@ MainLoop(FILE *source)
298296
bslash_count = 0;
299297

300298
rescan:
301-
/* in quote? */
302-
if (in_quote)
299+
/* start of extended comment? */
300+
if (line[i] == '/' && line[i + thislen] == '*')
303301
{
304-
/* end of quote */
305-
if (line[i] == in_quote && bslash_count % 2 == 0)
306-
in_quote = '\0';
302+
xcomment = true;
303+
ADVANCE_1;
307304
}
308305

309-
/* start of quote */
310-
else if (!was_bslash && (line[i] == '\'' || line[i] == '"'))
311-
in_quote = line[i];
312-
313306
/* in extended comment? */
314307
else if (xcomment)
315308
{
@@ -320,20 +313,26 @@ MainLoop(FILE *source)
320313
}
321314
}
322315

323-
/* start of extended comment? */
324-
else if (line[i] == '/' && line[i + thislen] == '*')
325-
{
326-
xcomment = true;
327-
ADVANCE_1;
328-
}
329-
330316
/* single-line comment? truncate line */
331317
else if (line[i] == '-' && line[i + thislen] == '-')
332318
{
333319
line[i] = '\0'; /* remove comment */
334320
break;
335321
}
336322

323+
/* in quote? */
324+
else if (in_quote)
325+
{
326+
/* end of quote */
327+
if (line[i] == in_quote && bslash_count % 2 == 0)
328+
in_quote = '\0';
329+
}
330+
331+
/* start of quote */
332+
else if (!was_bslash &&
333+
(line[i] == '\'' || line[i] == '"'))
334+
in_quote = line[i];
335+
337336
/* count nested parentheses */
338337
else if (line[i] == '(')
339338
paren_level++;

0 commit comments

Comments
 (0)
0