200211.1 · 2c3b0dccc81e08059f1be983aeb6377ebf239cac
released 1.7.8 - fixed an issue when mmap is not enabled
reading declarations
@@ -3,7 +3,7 @@ Universal grep ("uber grep") ============================ -Search everything for anything... fast.+Search for anything in everything... fast. <br> <div align="center">@@ -30,7 +30,7 @@ search pdf and office documents using filters - Comprehensive how-to [tutorial](#tutorial) for beginners to advanced users - Fully compatible with the standard GNU and BSD grep command-line options - Written in clean and efficient C++11, built for extreme speed-- Faster than GNU/BSD/PCRE grep, beating ripgrep, silver searcher, etc.+- Faster than GNU/BSD/PCRE grep, [also beats](#speed) ripgrep, silver searcher, etc. - Multi-threaded search using high-performance lock-free job queue stealing - Multi-threaded decompression and search of decompressed streams - Optimized with SIMD string matching (AVX, SSE2, ARM NEON/AArch64)@@ -226,7 +226,7 @@ Speed ### Tests -The following tests span a range of use cases:+The following tests span a range of practical use cases: Test | Command | Description ---- | ---------------------------------------------------------------- | -----------------------------------------------------@@ -3397,7 +3397,7 @@ in markdown: - ugrep 1.7.7 February 10, 2020 UGREP(1)+ ugrep 1.7.8 February 11, 2020 UGREP(1) <a name="patterns"/>
bin/linux/ugrep
bin/macosx/ugrep
@@ -98,7 +98,7 @@ void Matcher::boyer_moore_init(const char *pat, size_t len) { // Relative frequency table of English letters, source code, and UTF-8 bytes static unsigned char freq[256] = "\0\0\0\0\0\0\0\0\0\73\4\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\73\70\70\1\1\2\2\70\70\70\2\2\70\70\70\2\3\3\3\3\3\3\3\3\3\3\70\70\70\70\70\70\2\35\14\24\26\37\20\17\30\33\11\12\25\22\32\34\15\7\27\31\36\23\13\21\10\16\6\70\1\70\2\70\1\67\46\56\60\72\52\51\62\65\43\44\57\54\64\66\47\41\61\63\71\55\45\53\42\50\40\70\2\70\2\0\47\47\47\47\47\47\47\47\47\47\47\47\47\47\47\47\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\44\44\44\44\44\44\44\44\44\44\44\44\44\44\44\44\0\0\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\46\56\56\56\56\56\56\56\56\56\56\56\56\46\56\56\73\0\0\0\0\0\0\0\0\0\0\0\0\0\0";- size_t i;+ uint16_t i; for (i = 0; i < 256; ++i) bms_[i] = static_cast<uint8_t>(len); // okay to cast: actually never more than 255 lcp_ = 0;@@ -120,7 +120,7 @@ void Matcher::boyer_moore_init(const char *pat, size_t len) } } }- size_t j;+ uint16_t j; for (i = len - 1, j = i; j > 0; --j) if (pat[j - 1] == pat[i]) break;@@ -379,16 +379,16 @@ bool Matcher::advance() { loc = s - lcp_ + offset - buf_; set_current(loc);- if (min == 0 || loc + 4 > end_)+ if (min == 0) return true; if (min >= 4) {- if (Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min))+ if (loc + len + min > end_ || Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min)) return true; } else {- if (Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0)+ if (loc + len + 4 > end_ || Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0) return true; } }@@ -415,16 +415,16 @@ bool Matcher::advance() { loc = s - lcp_ + offset - buf_; set_current(loc);- if (min == 0 || loc + 4 > end_)+ if (min == 0) return true; if (min >= 4) {- if (Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min))+ if (loc + len + min > end_ || Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min)) return true; } else {- if (Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0)+ if (loc + len + 4 > end_ || Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0) return true; } }@@ -452,16 +452,16 @@ bool Matcher::advance() { loc = s - lcp_ + offset - buf_; set_current(loc);- if (min == 0 || loc + 4 > end_)+ if (min == 0) return true; if (min >= 4) {- if (Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min))+ if (loc + len + min > end_ || Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min)) return true; } else {- if (Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0)+ if (loc + len + 4 > end_ || Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0) return true; } }@@ -490,16 +490,16 @@ bool Matcher::advance() { loc = s - lcp_ + i - buf_; set_current(loc);- if (min == 0 || loc + 4 > end_)+ if (min == 0) return true; if (min >= 4) {- if (Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min))+ if (loc + len + min > end_ || Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min)) return true; } else {- if (Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0)+ if (loc + len + 4 > end_ || Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0) return true; } }@@ -514,16 +514,16 @@ bool Matcher::advance() { loc = s - lcp_ + i + 8 - buf_; set_current(loc);- if (min == 0 || loc + 4 > end_)+ if (min == 0) return true; if (min >= 4) {- if (Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min))+ if (loc + len + min > end_ || Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min)) return true; } else {- if (Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0)+ if (loc + len + 4 > end_ || Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0) return true; } }@@ -545,18 +545,18 @@ bool Matcher::advance() } if (len <= 2 || memcmp(s - lcp_, pre, len) == 0) {- loc = s - lcp_ - buf_;+ loc = s - lcp_ - buf_; set_current(loc);- if (min == 0 || loc + 4 > end_)+ if (min == 0) return true; if (min >= 4) {- if (Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min))+ if (loc + len + min > end_ || Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min)) return true; } else {- if (Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0)+ if (loc + len + 4 > end_ || Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0) return true; } }@@ -597,16 +597,16 @@ bool Matcher::advance() { loc = q - buf_ + 1; set_current(loc);- if (min == 0 || loc + 4 > end_)+ if (min == 0) return true; if (min >= 4) {- if (Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min))+ if (loc + len + min > end_ || Pattern::predict_match(pat_->pmh_, &buf_[loc + len], min)) return true; } else {- if (Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0)+ if (loc + len + 4 > end_ || Pattern::predict_match(pat_->pma_, &buf_[loc + len]) == 0) return true; } }
@@ -2653,7 +2653,7 @@ void Pattern::predict_match_dfa(State& start) break; } State *next = state->edges.begin()->second.second;- if (next == NULL || next->index < state->index)+ if (next == NULL) { one_ = false; break;
@@ -1,4 +1,4 @@-.TH UGREP "1" "February 10, 2020" "ugrep 1.7.7" "User Commands"+.TH UGREP "1" "February 11, 2020" "ugrep 1.7.8" "User Commands" .SH NAME \fBugrep\fR -- universal file pattern searcher .SH SYNOPSIS
@@ -70,7 +70,7 @@ Prebuilt executables are located in ugrep/bin. */ // ugrep version-#define UGREP_VERSION "1.7.7"+#define UGREP_VERSION "1.7.8" #include <reflex/input.h> #include <reflex/matcher.h>
@@ -149,7 +149,7 @@ done | gzip -c > archive.gz $UG -z -c '' archive.gz > out/archive.gz.out -for PAT in '.' 'et' 'hendrerit' 'aliquam' 'sit amet aliquam' 'Nunc hendrerit at metus sit amet aliquam'; do+for PAT in '\.' 'et' 'hendrerit' 'aliquam' 'sit amet aliquam' 'Nunc hendrerit at metus sit amet aliquam' 'adip[a-z]{1,}' 'adip[a-z]{4,}'; do FN=`echo "archive_$PAT" | tr -Cd '[:alnum:]_'`- $UG -z -Fco "$PAT" archive.gz > out/$FN-Fco.gz.out+ $UG -z -co "$PAT" archive.gz > out/$FN-co.gz.out done
tests/out/archive_-Fco.gz.out
@@ -1 +0,0 @@-200000
@@ -0,0 +1 @@+200000
tests/out/archive_Nunchendreritatmetussitametaliquam-Fco.gz.out
@@ -1 +0,0 @@-100000
tests/out/archive_Nunchendreritatmetussitametaliquam-co.gz.out
@@ -0,0 +1 @@+100000
tests/out/archive_adipaz1-co.gz.out
@@ -0,0 +1 @@+100000
tests/out/archive_adipaz4-co.gz.out
@@ -0,0 +1 @@+100000
tests/out/archive_aliquam-Fco.gz.out
@@ -1 +0,0 @@-100000
tests/out/archive_aliquam-co.gz.out
@@ -0,0 +1 @@+100000
tests/out/archive_et-Fco.gz.out
@@ -1 +0,0 @@-400000
tests/out/archive_et-co.gz.out
@@ -0,0 +1 @@+400000
tests/out/archive_hendrerit-Fco.gz.out
@@ -1 +0,0 @@-100000
tests/out/archive_hendrerit-co.gz.out
@@ -0,0 +1 @@+100000
tests/out/archive_sitametaliquam-Fco.gz.out
@@ -1 +0,0 @@-100000
tests/out/archive_sitametaliquam-co.gz.out
@@ -0,0 +1 @@+100000
@@ -265,10 +265,10 @@ fi if [ "$have_libz" == yes ]; then printf . $UG -z -c '' archive.gz | $DIFF out/archive.gz.out || ERR "-z -c '' archive.gz"-for PAT in '.' 'et' 'hendrerit' 'aliquam' 'sit amet aliquam' 'Nunc hendrerit at metus sit amet aliquam'; do+for PAT in '\.' 'et' 'hendrerit' 'aliquam' 'sit amet aliquam' 'Nunc hendrerit at metus sit amet aliquam' 'adip[a-z]{1,}' 'adip[a-z]{4,}'; do FN=`echo "archive_$PAT" | tr -Cd '[:alnum:]_'` printf .- $UG -z -Fco "$PAT" archive.gz | $DIFF out/$FN-Fco.gz.out || ERR "-z -Fco \"$PAT\" archive.gz"+ $UG -z -co "$PAT" archive.gz | $DIFF out/$FN-co.gz.out || ERR "-z -co \"$PAT\" archive.gz" done fi