9
9
*
10
10
*
11
11
* IDENTIFICATION
12
- * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.89 2001/09/04 00:19:39 petere Exp $
12
+ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.90 2001/09/07 23:17:14 tgl Exp $
13
13
*
14
14
*-------------------------------------------------------------------------
15
15
*/
@@ -69,6 +69,8 @@ void unput(char);
69
69
70
70
extern YYSTYPE yylval;
71
71
72
+ static int xcdepth = 0 ; /* depth of nesting in slash-star comments */
73
+
72
74
/*
73
75
* literalbuf is used to accumulate literal values when multiple rules
74
76
* are needed to parse a single literal. Call startlit to reset buffer
@@ -79,8 +81,6 @@ static char *literalbuf; /* expandable buffer */
79
81
static int literallen; /* actual current length */
80
82
static int literalalloc; /* current allocated buffer size */
81
83
82
- static int xcdepth = 0 ; /* depth of nesting in slash-star comments */
83
-
84
84
#define startlit () (literalbuf[0 ] = ' \0 ' , literallen = 0 )
85
85
static void addlit (char *ytext, int yleng);
86
86
@@ -375,7 +375,7 @@ other .
375
375
return IDENT;
376
376
}
377
377
<xd >{xddouble } {
378
- addlit (yytext+ 1 , yyleng-1 );
378
+ addlit (yytext, yyleng-1 );
379
379
}
380
380
<xd >{xdinside } {
381
381
addlit (yytext, yyleng);
@@ -581,9 +581,10 @@ addlit(char *ytext, int yleng)
581
581
} while ((literallen+yleng) >= literalalloc);
582
582
literalbuf = (char *) repalloc (literalbuf, literalalloc);
583
583
}
584
- /* append data --- note we assume ytext is null-terminated */
585
- memcpy (literalbuf+literallen, ytext, yleng+ 1 );
584
+ /* append new data, add trailing null */
585
+ memcpy (literalbuf+literallen, ytext, yleng);
586
586
literallen += yleng;
587
+ literalbuf[literallen] = ' \0 ' ;
587
588
}
588
589
589
590
#if !defined(FLEX_SCANNER)
0 commit comments