From 34ec85bfe38062b67f0fd5542389c961d14d9fd6 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 2 Dec 2024 10:35:37 +0100 Subject: [PATCH v2 07/11] 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 347e54cfb06..9eac11229c6 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