#include "wx/intl.h"
#endif //WX_PRECOMP
-// FreeBSD requires this, it probably doesn't hurt for others
-#ifdef __UNIX__
+// FreeBSD & Watcom require this, it probably doesn't hurt for others
+#if defined(__UNIX__) || defined(__WATCOMC__) || defined(__DIGITALMARS__)
#include <sys/types.h>
#endif
// return the string containing the error message for the given err code
wxString GetErrorMsg(int errorcode) const;
+ // init the members
+ void Init()
+ {
+ m_isCompiled = FALSE;
+ m_Matches = NULL;
+ m_nMatches = 0;
+ }
+
// free the RE if compiled
void Free()
{
if ( IsValid() )
{
regfree(&m_RegEx);
-
- m_isCompiled = FALSE;
}
+
+ delete [] m_Matches;
}
+ // free the RE if any and reinit the members
+ void Reinit()
+ {
+ Free();
+ Init();
+ }
+
+
// compiled RE
regex_t m_RegEx;
wxRegExImpl::wxRegExImpl()
{
- m_isCompiled = FALSE;
- m_Matches = NULL;
- m_nMatches = 0;
+ Init();
}
wxRegExImpl::~wxRegExImpl()
{
Free();
-
- delete [] m_Matches;
}
wxString wxRegExImpl::GetErrorMsg(int errorcode) const
(void)regerror(errorcode, &m_RegEx, (char *)buf.data(), len);
- msg = buf.data();
+ msg = wxString(buf.data(), wxConvLibc);
#else // !Unicode
(void)regerror(errorcode, &m_RegEx, msg.GetWriteBuf(len), len);
bool wxRegExImpl::Compile(const wxString& expr, int flags)
{
- Free();
+ Reinit();
// translate our flags to regcomp() ones
wxASSERT_MSG( !(flags &