Revision: 908
http://www.exim.org/viewvc/pcre2?view=rev&revision=908
Author: ph10
Date: 2018-01-12 17:55:47 +0000 (Fri, 12 Jan 2018)
Log Message:
-----------
Fix problem when compiling without Unicode support.
Modified Paths:
--------------
code/trunk/src/pcre2_extuni.c
Modified: code/trunk/src/pcre2_extuni.c
===================================================================
--- code/trunk/src/pcre2_extuni.c 2018-01-10 09:28:03 UTC (rev 907)
+++ code/trunk/src/pcre2_extuni.c 2018-01-12 17:55:47 UTC (rev 908)
@@ -7,7 +7,7 @@
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016-2017 University of Cambridge
+ New API code Copyright (c) 2016-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,9 @@
/* This module contains an internal function that is used to match a Unicode
extended grapheme sequence. It is used by both pcre2_match() and
-pcre2_def_match(). */
+pcre2_def_match(). However, it is called only when Unicode support is being
+compiled. Nevertheless, we provide a dummy function when there is no Unicode
+support, because some compilers do not like functionless source files. */
#ifdef HAVE_CONFIG_H
@@ -50,19 +52,38 @@
#include "pcre2_internal.h"
+
+/* Dummy function */
+
+#ifndef SUPPORT_UNICODE
+PCRE2_SPTR
+PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject,
+ PCRE2_SPTR end_subject, BOOL utf, int *xcount)
+{
+(void)c;
+(void)eptr;
+(void)start_subject;
+(void)end_subject;
+(void)utf;
+(void)xcount;
+return NULL;
+}
+#else
+
+
/*************************************************
* Match an extended grapheme sequence *
*************************************************/
-/*
+/*
Arguments:
c the first character
eptr pointer to next character
start_subject pointer to start of subject
- end_subject pointer to end of subject
+ end_subject pointer to end of subject
utf TRUE if in UTF mode
xcount pointer to count of additional characters,
- or NULL if count not needed
+ or NULL if count not needed
Returns: pointer after the end of the sequence
*/
@@ -75,7 +96,7 @@
while (eptr < end_subject)
{
- int rgb;
+ int rgb;
int len = 1;
if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
rgb = UCD_GRAPHBREAK(c);
@@ -88,9 +109,7 @@
{
int ricount = 0;
PCRE2_SPTR bptr = eptr - 1;
-#ifdef SUPPORT_UNICODE
if (utf) BACKCHAR(bptr);
-#endif
/* bptr is pointing to the left-hand character */
@@ -97,7 +116,6 @@
while (bptr > start_subject)
{
bptr--;
-#ifdef SUPPORT_UNICODE
if (utf)
{
BACKCHAR(bptr);
@@ -104,7 +122,6 @@
GETCHAR(c, bptr);
}
else
-#endif
c = *bptr;
if (UCD_GRAPHBREAK(c) != ucp_gbRegionalIndicator) break;
ricount++;
@@ -120,10 +137,12 @@
lgb = rgb;
eptr += len;
- if (xcount != NULL) *xcount += 1;
+ if (xcount != NULL) *xcount += 1;
}
return eptr;
}
+#endif /* SUPPORT_UNICODE */
+
/* End of pcre2_extuni.c */