summaryrefslogtreecommitdiff
path: root/pcreposix.c
diff options
context:
space:
mode:
authornigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-02-24 21:40:30 +0000
committernigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-02-24 21:40:30 +0000
commit568064fe47fac0c7caffc684e6ea227ad8127b70 (patch)
tree8891ffb119dd71e1d00083046876bdb6abbf28f9 /pcreposix.c
parent4af6fcff808e079ca1aa09104d6146baa932af47 (diff)
downloadpcre-568064fe47fac0c7caffc684e6ea227ad8127b70.tar.gz
Load pcre-4.5 into code/trunk.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@73 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcreposix.c')
-rw-r--r--pcreposix.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/pcreposix.c b/pcreposix.c
index 6152a15..856c97b 100644
--- a/pcreposix.c
+++ b/pcreposix.c
@@ -43,14 +43,14 @@ restrictions:
/* Corresponding tables of PCRE error messages and POSIX error codes. */
-static const char *estring[] = {
+static const char *const estring[] = {
ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10,
ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20,
ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR29, ERR29, ERR30,
ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39, ERR40,
ERR41, ERR42, ERR43, ERR44 };
-static int eint[] = {
+static const int eint[] = {
REG_EESCAPE, /* "\\ at end of pattern" */
REG_EESCAPE, /* "\\c at end of pattern" */
REG_EESCAPE, /* "unrecognized character follows \\" */
@@ -99,7 +99,7 @@ static int eint[] = {
/* Table of texts corresponding to POSIX error codes */
-static const char *pstring[] = {
+static const char *const pstring[] = {
"", /* Dummy for value 0 */
"internal error", /* REG_ASSERT */
"invalid repeat counts in {}", /* BADBR */
@@ -145,7 +145,7 @@ return REG_ASSERT;
* Translate error code to string *
*************************************************/
-size_t
+EXPORT size_t
regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
{
const char *message, *addmessage;
@@ -180,7 +180,7 @@ return length + addlength;
* Free store held by a regex *
*************************************************/
-void
+EXPORT void
regfree(regex_t *preg)
{
(pcre_free)(preg->re_pcre);
@@ -203,7 +203,7 @@ Returns: 0 on success
various non-zero codes on failure
*/
-int
+EXPORT int
regcomp(regex_t *preg, const char *pattern, int cflags)
{
const char *errorptr;
@@ -236,7 +236,7 @@ ints. However, if the number of possible capturing brackets is small, use a
block of store on the stack, to reduce the use of malloc/free. The threshold is
in a macro that can be changed at configure time. */
-int
+EXPORT int
regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags)
{
@@ -294,6 +294,9 @@ else
case PCRE_ERROR_BADMAGIC: return REG_INVARG;
case PCRE_ERROR_UNKNOWN_NODE: return REG_ASSERT;
case PCRE_ERROR_NOMEMORY: return REG_ESPACE;
+ case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE;
+ case PCRE_ERROR_BADUTF8: return REG_INVARG;
+ case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG;
default: return REG_ASSERT;
}
}