--- code/trunk/pcreposix.c 2007/02/24 21:40:26 72 +++ code/trunk/pcreposix.c 2007/02/24 21:40:30 73 @@ -43,14 +43,14 @@ /* 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 @@ /* 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 @@ * 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 @@ * Free store held by a regex * *************************************************/ -void +EXPORT void regfree(regex_t *preg) { (pcre_free)(preg->re_pcre); @@ -203,7 +203,7 @@ 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 @@ 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 @@ 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; } }