From 5404582d2bfb6dfa9ed6ed6d7d7ab6877ab13597 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 2 Dec 2024 10:35:37 +0100 Subject: [PATCH v1 12/19] syncrep parser: Simplify flex scan buffer management --- src/backend/replication/syncrep_scanner.l | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/backend/replication/syncrep_scanner.l b/src/backend/replication/syncrep_scanner.l index ac2eecd7804..9c0f4fc2c19 100644 --- a/src/backend/replication/syncrep_scanner.l +++ b/src/backend/replication/syncrep_scanner.l @@ -148,8 +148,6 @@ syncrep_yyerror(yyscan_t yyscanner, const char *message) void syncrep_scanner_init(const char *str, yyscan_t *yyscannerp) { - Size slen = strlen(str); - char *scanbuf; yyscan_t yyscanner; if (yylex_init(yyscannerp) != 0) @@ -157,13 +155,7 @@ syncrep_scanner_init(const char *str, yyscan_t *yyscannerp) yyscanner = *yyscannerp; - /* - * Make a scan buffer with special termination needed by flex. - */ - scanbuf = (char *) palloc(slen + 2); - memcpy(scanbuf, str, slen); - scanbuf[slen] = scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR; - yy_scan_buffer(scanbuf, slen + 2, yyscanner); + yy_scan_string(str, yyscanner); } void -- 2.47.1