1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Upgrading libpcre from version 6.7 to 7.2. The old distributed libpcre was ~900k, this one is 1.3M. But, the old 6.7 vanilla was 4.1M, while 7.2 is 4.9M in size. I've tested it on Linux and Windows, with no problems

This commit is contained in:
kris
2007-08-16 16:57:22 +00:00
parent e765af4103
commit 4500b7f173
54 changed files with 18266 additions and 6337 deletions

View File

@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Copyright (c) 1997-2006 University of Cambridge
Copyright (c) 1997-2007 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -78,9 +78,9 @@ static const int eint[] = {
REG_BADPAT, /* unrecognized character after (?< */
REG_BADPAT, /* lookbehind assertion is not fixed length */
REG_BADPAT, /* malformed number or name after (?( */
REG_BADPAT, /* conditional group containe more than two branches */
REG_BADPAT, /* conditional group contains more than two branches */
REG_BADPAT, /* assertion expected after (?( */
REG_BADPAT, /* (?R or (?digits must be followed by ) */
REG_BADPAT, /* (?R or (?[+-]digits must be followed by ) */
REG_ECTYPE, /* unknown POSIX class name */
REG_BADPAT, /* POSIX collating elements are not supported */
REG_INVARG, /* this version of PCRE is not compiled with PCRE_UTF8 support */
@@ -93,7 +93,7 @@ static const int eint[] = {
REG_BADPAT, /* closing ) for (?C expected */
REG_BADPAT, /* recursive call could loop indefinitely */
REG_BADPAT, /* unrecognized character after (?P */
REG_BADPAT, /* syntax error after (?P */
REG_BADPAT, /* syntax error in subpattern name (missing terminator) */
REG_BADPAT, /* two named subpatterns have the same name */
REG_BADPAT, /* invalid UTF-8 string */
REG_BADPAT, /* support for \P, \p, and \X has not been compiled */
@@ -102,7 +102,14 @@ static const int eint[] = {
REG_BADPAT, /* subpattern name is too long (maximum 32 characters) */
REG_BADPAT, /* too many named subpatterns (maximum 10,000) */
REG_BADPAT, /* repeated subpattern is too long */
REG_BADPAT /* octal value is greater than \377 (not in UTF-8 mode) */
REG_BADPAT, /* octal value is greater than \377 (not in UTF-8 mode) */
REG_BADPAT, /* internal error: overran compiling workspace */
REG_BADPAT, /* internal error: previously-checked referenced subpattern not found */
REG_BADPAT, /* DEFINE group contains more than one branch */
REG_BADPAT, /* repeating a DEFINE group is not allowed */
REG_INVARG, /* inconsistent NEWLINE options */
REG_BADPAT, /* \g is not followed followed by an (optionally braced) non-zero number */
REG_BADPAT /* (?+ or (?- must be followed by a non-zero number */
};
/* Table of texts corresponding to POSIX error codes */
@@ -135,7 +142,7 @@ static const char *const pstring[] = {
* Translate error code to string *
*************************************************/
PCRE_DATA_SCOPE size_t
PCREPOSIX_EXP_DEFN size_t
regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
{
const char *message, *addmessage;
@@ -170,7 +177,7 @@ return length + addlength;
* Free store held by a regex *
*************************************************/
PCRE_DATA_SCOPE void
PCREPOSIX_EXP_DEFN void
regfree(regex_t *preg)
{
(pcre_free)(preg->re_pcre);
@@ -193,7 +200,7 @@ Returns: 0 on success
various non-zero codes on failure
*/
PCRE_DATA_SCOPE int
PCREPOSIX_EXP_DEFN int
regcomp(regex_t *preg, const char *pattern, int cflags)
{
const char *errorptr;
@@ -201,9 +208,9 @@ int erroffset;
int errorcode;
int options = 0;
if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
if ((cflags & REG_DOTALL) != 0) options |= PCRE_DOTALL;
if ((cflags & REG_DOTALL) != 0) options |= PCRE_DOTALL;
if ((cflags & REG_NOSUB) != 0) options |= PCRE_NO_AUTO_CAPTURE;
if ((cflags & REG_UTF8) != 0) options |= PCRE_UTF8;
@@ -235,7 +242,7 @@ If REG_NOSUB was specified at compile time, the PCRE_NO_AUTO_CAPTURE flag will
be set. When this is the case, the nmatch and pmatch arguments are ignored, and
the only result is yes/no/error. */
PCRE_DATA_SCOPE int
PCREPOSIX_EXP_DEFN int
regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags)
{
@@ -282,13 +289,13 @@ if (rc >= 0)
size_t i;
if (!nosub)
{
for (i = 0; i < (size_t)rc; i++)
{
pmatch[i].rm_so = ovector[i*2];
pmatch[i].rm_eo = ovector[i*2+1];
}
if (allocated_ovector) free(ovector);
for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
for (i = 0; i < (size_t)rc; i++)
{
pmatch[i].rm_so = ovector[i*2];
pmatch[i].rm_eo = ovector[i*2+1];
}
if (allocated_ovector) free(ovector);
for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
}
return 0;
}