From 3935b2a4f656e8435812df25cf7aab9f7e61b406 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 12 Nov 2021 21:34:12 -0800 Subject: grep: improve pcre2_get_error_message comments * src/pcresearch.c (Pcompile): Improve comments re pcre2_get_error_message buffer. --- src/pcresearch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pcresearch.c b/src/pcresearch.c index bf966f80..286e1dc3 100644 --- a/src/pcresearch.c +++ b/src/pcresearch.c @@ -112,7 +112,6 @@ Pcompile (char *pattern, idx_t size, reg_syntax_t ignored, bool exact) { PCRE2_SIZE e; int ec; - PCRE2_UCHAR8 ep[128]; /* 120 code units is suggested to avoid truncation */ static char const wprefix[] = "(?cre = pcre2_compile (re, n - (char *)re, flags, &ec, &e, ccontext); if (!pc->cre) { - pcre2_get_error_message (ec, ep, sizeof (ep)); + enum { ERRBUFSIZ = 256 }; /* Taken from pcre2grep.c ERRBUFSIZ. */ + PCRE2_UCHAR8 ep[ERRBUFSIZ]; + pcre2_get_error_message (ec, ep, sizeof ep); die (EXIT_TROUBLE, 0, "%s", ep); } -- cgit v1.2.1