X-Git-Url: http://www.andromeda.nl/gitweb/?a=blobdiff_plain;f=src%2Fregex.cpp;fp=src%2Fregex.cpp;h=f1c50332025d687be7076df593ead6eac5684362;hb=644da49529f2b634c149839230210fa294a604d6;hp=025ff404cc3a157e815b18703f1f6103ce3c182b;hpb=589f864578ff59a36815af5d897d2d94b9fe5578;p=AXE.git diff --git a/src/regex.cpp b/src/regex.cpp index 025ff40..f1c5033 100644 --- a/src/regex.cpp +++ b/src/regex.cpp @@ -5,7 +5,7 @@ *********************** ** FILE NAME : regex.cpp ** SYSTEM NAME : Andromeda X-Windows Encapsulation -** VERSION NUMBER : $Revision: 1.2 $ +** VERSION NUMBER : $Revision: 1.3 $ ** ** DESCRIPTION : regex class implementation. ** @@ -23,7 +23,10 @@ /***************************** $Log: regex.cpp,v $ - Revision 1.2 2002-09-28 06:45:51 arjen + Revision 1.3 2007-05-04 13:56:05 arjen + Added a copy contructor to the regex class. This prevents multiple frees in the destructor. + + Revision 1.2 2002/09/28 06:45:51 arjen New feature: subtring selection by regular expression. Bugfix: use the std: namespace for STL classes istream and ostream @@ -32,7 +35,7 @@ *****************************/ -static const char RCSID[] = "$Id: regex.cpp,v 1.2 2002-09-28 06:45:51 arjen Exp $"; +static const char RCSID[] = "$Id: regex.cpp,v 1.3 2007-05-04 13:56:05 arjen Exp $"; #include #include @@ -42,14 +45,22 @@ static const char RCSID[] = "$Id: regex.cpp,v 1.2 2002-09-28 06:45:51 arjen Exp regex::regex(const String ®) { + original = reg; regcomp (&expression, reg.p->s, REG_EXTENDED); } regex::regex(const char *reg) { + original = reg; regcomp (&expression, reg, REG_EXTENDED); } +regex::regex(const regex & reg) +{ + original = reg.original; + regcomp (&expression, reg.original, REG_EXTENDED); +} + regex::~regex() { regfree(&expression);