From 2c41a75b06c4e2d3a0bfb70d90d7a6af13c7da92 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 2 Dec 2024 10:35:37 +0100 Subject: [PATCH v0 09/15] replication parser: Simplify flex scan buffer management --- src/backend/replication/repl_scanner.l | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/backend/replication/repl_scanner.l b/src/backend/replication/repl_scanner.l index 6bd25e77880..56f93e681ed 100644 --- a/src/backend/replication/repl_scanner.l +++ b/src/backend/replication/repl_scanner.l @@ -256,8 +256,6 @@ replication_yyerror(yyscan_t yyscanner, const char *message) void replication_scanner_init(const char *str, yyscan_t *yyscannerp) { - Size slen = strlen(str); - char *scanbuf; yyscan_t yyscanner; if (yylex_init(yyscannerp) != 0) @@ -265,13 +263,7 @@ replication_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); /* Make sure we start in proper state */ repl_pushed_back_token = 0; -- 2.47.1