From 1be2b04607353cfa6576bd7c6ab42eee5b9009cc Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 2 Dec 2024 10:35:37 +0100 Subject: [PATCH v2 03/11] 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 be633a6e826..6388024a598 100644 --- a/src/backend/replication/repl_scanner.l +++ b/src/backend/replication/repl_scanner.l @@ -255,8 +255,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) @@ -264,13 +262,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