diff options
Diffstat (limited to 'gcc/cobol/dts.h')
-rw-r--r-- | gcc/cobol/dts.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/cobol/dts.h b/gcc/cobol/dts.h index c345dc7..aa3fa58 100644 --- a/gcc/cobol/dts.h +++ b/gcc/cobol/dts.h @@ -33,14 +33,15 @@ namespace dts { : input(input) , first(NULL), second(NULL), matched(false) { - static regmatch_t empty = { -1, -1 }; - regmatch_t& self(*this); + static regmatch_t empty; + empty.rm_so = empty.rm_eo = -1; + regmatch_t& self(*this); // cppcheck-suppress constVariableReference self = empty; } csub_match( const char input[], const regmatch_t& m ) : input(input) { - regmatch_t& self(*this); + regmatch_t& self(*this); // cppcheck-suppress constVariableReference self = m; matched = rm_so != -1; first = rm_so == -1? NULL : input + rm_so; @@ -67,7 +68,6 @@ namespace dts { #if __cpp_exceptions throw std::logic_error(msg); #else - pattern = NULL; cbl_errx("%s", msg); #endif } @@ -77,7 +77,7 @@ namespace dts { size_t size() const { return nsubexpr; } bool ready() const { return pattern != NULL; } private: - regex( const regex& ) {} + regex( const regex& ) = default; }; inline bool regex_search( const char input[], const char *eoinput, @@ -87,10 +87,10 @@ namespace dts { static const char msg[] = "input not NUL-terminated"; throw std::domain_error( msg ); #else - eoinput = strchr(input, '\0'); + // eoinput terminates input + eoinput = strchr(input, '\0'); // cppcheck-suppress uselessAssignmentPtrArg #endif } - if( eoinput == NULL ) eoinput = strchr(input, '\0'); auto ncm = re.size(); cm.resize(ncm); std::vector <regmatch_t> cms(ncm); |