summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-11-12 21:34:12 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2021-11-14 12:13:28 -0800
commit3935b2a4f656e8435812df25cf7aab9f7e61b406 (patch)
tree816f7294bf4110606777e8c73ad9b6c81329cff2 /src
parent6f84f3be1cdd3aadacc42007582116d1c2c0a3e4 (diff)
downloadgrep-3935b2a4f656e8435812df25cf7aab9f7e61b406.tar.gz
grep: improve pcre2_get_error_message comments
* src/pcresearch.c (Pcompile): Improve comments re pcre2_get_error_message buffer.
Diffstat (limited to 'src')
-rw-r--r--src/pcresearch.c5
1 files changed, 3 insertions, 2 deletions
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[] = "(?<!\\w)(?:";
static char const wsuffix[] = ")(?!\\w)";
static char const xprefix[] = "^(?:";
@@ -168,7 +167,9 @@ Pcompile (char *pattern, idx_t size, reg_syntax_t ignored, bool exact)
pc->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);
}