summaryrefslogtreecommitdiff
path: root/pcre_xclass.c
diff options
context:
space:
mode:
authornigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-02-24 21:41:21 +0000
committernigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-02-24 21:41:21 +0000
commitced1f145fdf26ec7df4b9048a9da0ef17e9618f2 (patch)
tree371f88a16cfb5ac0a176622bcd424aa6c28c4cc8 /pcre_xclass.c
parent2550303b1f255c525d802f94d9c4411a0ccc630f (diff)
downloadpcre-ced1f145fdf26ec7df4b9048a9da0ef17e9618f2.tar.gz
Load pcre-6.5 into code/trunk.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@87 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_xclass.c')
-rw-r--r--pcre_xclass.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/pcre_xclass.c b/pcre_xclass.c
index 4a4f895..57c514b 100644
--- a/pcre_xclass.c
+++ b/pcre_xclass.c
@@ -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-2005 University of Cambridge
+ Copyright (c) 1997-2006 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -60,7 +60,7 @@ Arguments:
Returns: TRUE if character matches, else FALSE
*/
-PCRE_EXPORT BOOL
+BOOL
_pcre_xclass(int c, const uschar *data)
{
int t;
@@ -100,17 +100,40 @@ while ((t = *data++) != XCL_END)
#ifdef SUPPORT_UCP
else /* XCL_PROP & XCL_NOTPROP */
{
- int chartype, othercase;
- int rqdtype = *data++;
- int category = _pcre_ucp_findchar(c, &chartype, &othercase);
- if (rqdtype >= 128)
- {
- if ((rqdtype - 128 == category) == (t == XCL_PROP)) return !negated;
- }
- else
+ int chartype, script;
+ int category = _pcre_ucp_findprop(c, &chartype, &script);
+
+ switch(*data)
{
- if ((rqdtype == chartype) == (t == XCL_PROP)) return !negated;
+ case PT_ANY:
+ if (t == XCL_PROP) return !negated;
+ break;
+
+ case PT_LAMP:
+ if ((chartype == ucp_Lu || chartype == ucp_Ll || chartype == ucp_Lt) ==
+ (t == XCL_PROP)) return !negated;
+ break;
+
+ case PT_GC:
+ if ((data[1] == category) == (t == XCL_PROP)) return !negated;
+ break;
+
+ case PT_PC:
+ if ((data[1] == chartype) == (t == XCL_PROP)) return !negated;
+ break;
+
+ case PT_SC:
+ if ((data[1] == script) == (t == XCL_PROP)) return !negated;
+ break;
+
+ /* This should never occur, but compilers may mutter if there is no
+ default. */
+
+ default:
+ return FALSE;
}
+
+ data += 2;
}
#endif /* SUPPORT_UCP */
}