summaryrefslogtreecommitdiff
path: root/pcreposix.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2009-09-02 16:02:56 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2009-09-02 16:02:56 +0000
commit5bda06fcd3562b292b125741fa74fc38a0c2a886 (patch)
treefdb5e283272ac1013ec8ffe6031459c9087df6e4 /pcreposix.c
parenta89489db04146da6d48aace6317a74e6a2f240dd (diff)
downloadpcre-5bda06fcd3562b292b125741fa74fc38a0c2a886.tar.gz
Add REG_UNGREEDY (non-standard) to the POSIX interface.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@432 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcreposix.c')
-rw-r--r--pcreposix.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/pcreposix.c b/pcreposix.c
index 8bc2f25..8f9e75f 100644
--- a/pcreposix.c
+++ b/pcreposix.c
@@ -240,11 +240,12 @@ int erroffset;
int errorcode;
int options = 0;
-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_NOSUB) != 0) options |= PCRE_NO_AUTO_CAPTURE;
-if ((cflags & REG_UTF8) != 0) options |= PCRE_UTF8;
+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_NOSUB) != 0) options |= PCRE_NO_AUTO_CAPTURE;
+if ((cflags & REG_UTF8) != 0) options |= PCRE_UTF8;
+if ((cflags & REG_UNGREEDY) != 0) options |= PCRE_UNGREEDY;
preg->re_pcre = pcre_compile2(pattern, options, &errorcode, &errorptr,
&erroffset, NULL);
@@ -299,10 +300,11 @@ if ((eflags & REG_NOTEMPTY) != 0) options |= PCRE_NOTEMPTY;
((regex_t *)preg)->re_erroffset = (size_t)(-1); /* Only has meaning after compile */
-/* When no string data is being returned, ensure that nmatch is zero.
-Otherwise, ensure the vector for holding the return data is large enough. */
+/* When no string data is being returned, or no vector has been passed in which
+to put it, ensure that nmatch is zero. Otherwise, ensure the vector for holding
+the return data is large enough. */
-if (nosub) nmatch = 0;
+if (nosub || pmatch == NULL) nmatch = 0;
else if (nmatch > 0)
{