]> git.notmuchmail.org Git - notmuch/blobdiff - lib/regexp-fields.cc
gmime-cleanup: pass NULL as default GMimeParserOptions
[notmuch] / lib / regexp-fields.cc
index 084bc8c019999cefe7b7d0dff01d27463d6cc4a7..5d4cf80aeea6f145630002c45ac31c4bda5f526c 100644 (file)
@@ -35,9 +35,9 @@ compile_regex (regex_t &regexp, const char *str)
     if (err != 0) {
        size_t len = regerror (err, &regexp, NULL, 0);
        char *buffer = new char[len];
-       std::string msg;
+       std::string msg = "Regexp error: ";
        (void) regerror (err, &regexp, buffer, len);
-       msg.assign (buffer, len);
+       msg.append (buffer, len);
        delete[] buffer;
 
        throw Xapian::QueryParserError (msg);
@@ -194,7 +194,7 @@ RegexpFieldProcessor::operator() (const std::string & str)
             * phrase parsing, when possible */
            std::string query_str;
 
-           if (str.find (' ') != std::string::npos)
+           if (*str.rbegin () != '*' || str.find (' ') != std::string::npos)
                query_str = '"' + str + '"';
            else
                query_str = str;