99 *
1010 *
1111 * 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 $
1313 *
1414 *-------------------------------------------------------------------------
1515*/
@@ -69,6 +69,8 @@ void unput(char);
6969
7070extern YYSTYPE yylval;
7171
72+ static int xcdepth =0 ;/* depth of nesting in slash-star comments*/
73+
7274/*
7375 * literalbuf is used to accumulate literal values when multiple rules
7476 * are needed to parse a single literal. Call startlit to reset buffer
@@ -79,8 +81,6 @@ static char *literalbuf;/* expandable buffer */
7981static int literallen;/* actual current length*/
8082static int literalalloc;/* current allocated buffer size*/
8183
82- static int xcdepth =0 ;/* depth of nesting in slash-star comments*/
83-
8484#define startlit () (literalbuf[0 ] =' \0 ' , literallen =0 )
8585static void addlit (char *ytext,int yleng);
8686
@@ -375,7 +375,7 @@ other.
375375return IDENT;
376376}
377377<xd >{xddouble } {
378- addlit (yytext+ 1 , yyleng-1 );
378+ addlit (yytext, yyleng-1 );
379379}
380380<xd >{xdinside }{
381381addlit (yytext, yyleng);
@@ -581,9 +581,10 @@ addlit(char *ytext, int yleng)
581581}while ((literallen+yleng) >= literalalloc);
582582literalbuf = (char *)repalloc (literalbuf, literalalloc);
583583}
584- /* append data --- note we assume ytext is null-terminated */
585- memcpy (literalbuf+literallen, ytext, yleng+ 1 );
584+ /* appendnew data, add trailing null */
585+ memcpy (literalbuf+literallen, ytext, yleng);
586586literallen += yleng;
587+ literalbuf[literallen] =' \0 ' ;
587588}
588589
589590#if !defined(FLEX_SCANNER)