aboutsummaryrefslogtreecommitdiff
path: root/src/regexp.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-08-06 19:42:22 +0000
committerMike Buland <eichlan@xagasoft.com>2006-08-06 19:42:22 +0000
commit71c3c523aacb0f6986d50f4a7a2e5d604728a4c4 (patch)
tree9000ae982c9cb21d31ac3efa6ccf7100064f5bbb /src/regexp.cpp
parent2c0c23b75f563d0a1e68f6079a8eea73c40a877a (diff)
downloadbuild-71c3c523aacb0f6986d50f4a7a2e5d604728a4c4.tar.gz
build-71c3c523aacb0f6986d50f4a7a2e5d604728a4c4.tar.bz2
build-71c3c523aacb0f6986d50f4a7a2e5d604728a4c4.tar.xz
build-71c3c523aacb0f6986d50f4a7a2e5d604728a4c4.zip
A load of updates, most of these made me realize that I probably could do this
whole thing a lot better. We'll see how that works out later, once I figure out how to do it better.
Diffstat (limited to 'src/regexp.cpp')
-rw-r--r--src/regexp.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/regexp.cpp b/src/regexp.cpp
index ff2d09a..e5a3535 100644
--- a/src/regexp.cpp
+++ b/src/regexp.cpp
@@ -17,14 +17,21 @@ RegExp::RegExp( const char *sSrc ) :
17 17
18RegExp::~RegExp() 18RegExp::~RegExp()
19{ 19{
20 regfree( &re ); 20 if( bCompiled )
21 delete[] aSubStr; 21 {
22 regfree( &re );
23 delete[] aSubStr;
24 }
22} 25}
23 26
24void RegExp::compile( const char *sSrc ) 27void RegExp::compile( const char *sSrc )
25{ 28{
26 if( bCompiled ) 29 if( bCompiled )
27 throw BuildException("Already compiled."); 30 {
31 regfree( &re );
32 delete[] aSubStr;
33 bCompiled = false;
34 }
28 35
29 int nErr = regcomp( &re, sSrc, REG_EXTENDED|REG_NEWLINE ); 36 int nErr = regcomp( &re, sSrc, REG_EXTENDED|REG_NEWLINE );
30 if( nErr ) 37 if( nErr )