commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
fa7b270198eeb3ba2ed264e0293e0bf73f002da2 | Frommi | 2017-08-21T16:18:29 | all states ported to Rust; fix some bugs, but not all: ../bin/miniz_tester -v a linux-4.8.11 passes but the rest with buffer size randomization fails; delete C delegation | diff --git a/src/tinfl/mod.rs b/src/tinfl/mod.rs
index 9490efe..15b3cec 100755
--- a/src/tinfl/mod.rs
+++ b/src/tinfl/mod.rs
@@ -37,10 +37,11 @@ impl tinfl_huff_table {
/// Get the huffman code and the length from the huffman tree.
#[inline]
- fn tree_lookup(&self,
- fast_symbol: i32,
-... | 2 | 195 | 142 |
1b43e769ccb7ae7fe832b3c698e2af0aa6852353 | oyvindln | 2017-08-21T01:17:10 | Port decoding of huffman codes and literal/match output to rust.
Should at least work on static blocks with no matches. Didn't get to testing anything else yet | diff --git a/src/tinfl/mod.rs b/src/tinfl/mod.rs
index 4cf9b6e..9490efe 100755
--- a/src/tinfl/mod.rs
+++ b/src/tinfl/mod.rs
@@ -25,6 +25,45 @@ impl tinfl_huff_table {
tree: [0; 576],
}
}
+
+ /// Look for a huffman code in the fast lookup table.
+ /// The code is stored in the lower 9 b... | 2 | 477 | 8 |
a4e94f7a70b78701bc6e1290ded93c92af2d892b | Frommi | 2017-08-18T15:25:47 | read dynamic table in tinfl | diff --git a/src/tinfl/mod.rs b/src/tinfl/mod.rs
index 409a522..4cf9b6e 100755
--- a/src/tinfl/mod.rs
+++ b/src/tinfl/mod.rs
@@ -68,6 +68,9 @@ pub const TDEFL_FILTER_MATCHES: u32 = 0x20000;
pub const TDEFL_FORCE_ALL_STATIC_BLOCKS: u32 = 0x40000;
pub const TDEFL_FORCE_ALL_RAW_BLOCKS: u32 = 0x80000;
+const MIN_TABLE_... | 2 | 32 | 0 |
9b0ab97eccd00b709357124dbe4af17578eafa78 | Frommi | 2017-08-18T15:02:28 | mem_to_mem and mem_to_heap now use oxide decompression | diff --git a/src/tinfl/mod.rs b/src/tinfl/mod.rs
index 0bc09a5..409a522 100755
--- a/src/tinfl/mod.rs
+++ b/src/tinfl/mod.rs
@@ -1,7 +1,7 @@
#![allow(dead_code)]
use ::libc::*;
-use std::{mem, ptr, usize};
+use std::{slice, mem, ptr, usize};
use std::io::Cursor;
mod tinfl_oxide;
@@ -145,30 +145,28 @@ pub const ... | 1 | 26 | 32 |
8d341f201164bac38ce70a5ec32637f780eaae73 | Frommi | 2017-08-18T13:51:16 | undo_bytes fix | diff --git a/src/tinfl/tinfl_oxide.rs b/src/tinfl/tinfl_oxide.rs
index a2a30cf..f603a03 100644
--- a/src/tinfl/tinfl_oxide.rs
+++ b/src/tinfl/tinfl_oxide.rs
@@ -136,7 +136,7 @@ fn end_of_input(flags: u32) -> Action {
#[inline]
fn undo_bytes(r: &mut tinfl_decompressor, max: u32) -> u32 {
let res = cmp::min((r.num... | 1 | 1 | 1 |
b4b8b55e17b22bc9736a8c0f4b5afa305dd9ea38 | Frommi | 2017-08-18T13:46:53 | raw ending; raw bug fixes; adler32 range fix, adler32 before delegating to C | diff --git a/src/tinfl/tinfl_oxide.rs b/src/tinfl/tinfl_oxide.rs
index e4aba55..a2a30cf 100644
--- a/src/tinfl/tinfl_oxide.rs
+++ b/src/tinfl/tinfl_oxide.rs
@@ -7,9 +7,7 @@ pub fn memset<T : Clone>(slice: &mut [T], val: T) {
for x in slice { *x = val.clone() }
}
-// Not in miniz
const START: u32 = 0;
-
const ... | 1 | 108 | 41 |
531db6b046224fd87394297217b340bea4fe70ba | oyvindln | 2017-08-18T00:54:04 | oxidise raw block decoding state.
Didn't quite finish the stream end bit as it was super late so zlib streams get adler32 mismatch atm
Please enter the commit message for your changes. Lines starting | diff --git a/src/tinfl/mod.rs b/src/tinfl/mod.rs
index e3fa555..0bc09a5 100755
--- a/src/tinfl/mod.rs
+++ b/src/tinfl/mod.rs
@@ -1,7 +1,6 @@
#![allow(dead_code)]
use ::libc::*;
-use std::cmp;
use std::{mem, ptr, usize};
use std::io::Cursor;
diff --git a/src/tinfl/tinfl_oxide.rs b/src/tinfl/tinfl_oxide.rs
index ... | 2 | 156 | 2 |
d4fc8073250ce77f6df37cec6ce52984985e9396 | Frommi | 2017-08-17T15:59:26 | read byte/bits funcs; READ_BLOCK_HEADER state; static table; init_tree | diff --git a/src/tinfl/mod.rs b/src/tinfl/mod.rs
index a923536..e3fa555 100755
--- a/src/tinfl/mod.rs
+++ b/src/tinfl/mod.rs
@@ -32,6 +32,8 @@ const TINFL_MAX_HUFF_TABLES: usize = 3;
const TINFL_MAX_HUFF_SYMBOLS_0: usize = 288;
const TINFL_MAX_HUFF_SYMBOLS_1: usize = 32;
const TINFL_MAX_HUFF_SYMBOLS_2: usize = 19;
+... | 2 | 43 | 38 |
32985fc6fae9cd3fdd70fb15c312c6cca0bf49ab | Frommi | 2017-08-17T11:22:00 | tinfl bugs; common exit | diff --git a/src/tinfl/mod.rs b/src/tinfl/mod.rs
index 48095d5..a923536 100755
--- a/src/tinfl/mod.rs
+++ b/src/tinfl/mod.rs
@@ -1,6 +1,7 @@
#![allow(dead_code)]
use ::libc::*;
+use std::cmp;
use std::{mem, ptr, usize};
use std::io::Cursor;
@@ -66,6 +67,8 @@ pub const TDEFL_FILTER_MATCHES: u32 = 0x20000;
pub c... | 2 | 46 | 36 |
c506d47ac22eeb4662df82d63530aee2e9ddd71d | oyvindln | 2017-08-16T23:19:41 | Port zlib header read and validation state to tinfl, add tests, fix some warnings, use slice iter | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index 51d9642..a8b1484 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -221,9 +221,9 @@ pub fn mz_deflate_oxide(
stream_oxide: &mut StreamOxide<tdefl_compressor>,
flush: c_int
) -> MZResult {
- let mut state = stream_oxide.state.as_mut().ok_or(MZErr... | 5 | 197 | 35 |
3e3e8b71ab4e38f8d5aabedb2ca1c0804aaac4e0 | Frommi | 2017-08-16T16:51:39 | remove match match | diff --git a/src/tinfl/tinfl_oxide.rs b/src/tinfl/tinfl_oxide.rs
index 2ddf71e..0eead38 100644
--- a/src/tinfl/tinfl_oxide.rs
+++ b/src/tinfl/tinfl_oxide.rs
@@ -23,7 +23,7 @@ pub fn decompress_oxide(
let mut in_buf = Cursor::new(in_buf);
let status = loop {
- match match r.state {
+ let action... | 1 | 4 | 2 |
20d7dcfed64f6aec679c1a03509bd987ba2712ff | Frommi | 2017-08-16T16:40:55 | decompress_oxide: state machine for tinfl; 2 states implemented | diff --git a/src/lib.rs b/src/lib.rs
index 4b6b9ee..94f79b3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,6 +4,7 @@ use std::slice;
use std::ptr;
use std::mem;
use std::cmp;
+use std::io::Cursor;
use libc::*;
@@ -164,7 +165,7 @@ pub struct inflate_state {
pub m_window_bits: c_int,
pub m_dict: [u8; ... | 4 | 142 | 46 |
f59d60fa54f1ede95438db274f22485cc1588023 | Frommi | 2017-08-16T12:18:24 | safe new for CallbackOxide; safe tdef in lib.rs | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index f72721a..5947f44 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -207,15 +207,16 @@ pub fn mz_deflate_init2_oxide(
stream_oxide.total_out = 0;
stream_oxide.state.alloc_state::<tdefl_compressor>()?;
- let status = unsafe {
- tdef::tdefl... | 3 | 51 | 37 |
3918b6bd80369a8f115448d098569e22ece69805 | Frommi | 2017-08-16T11:36:51 | all huffman functions to methods | diff --git a/src/tdef/tdef_oxide.rs b/src/tdef/tdef_oxide.rs
index 49dc703..9187512 100644
--- a/src/tdef/tdef_oxide.rs
+++ b/src/tdef/tdef_oxide.rs
@@ -377,7 +377,125 @@ impl HuffmanOxide {
}
}
- pub fn optimize_huffman_table(
+ pub fn radix_sort_symbols<'a>(
+ symbols0: &'a mut [SymFreq],... | 1 | 127 | 127 |
4bbd9428954fe001e3abdedf300f1fc233c0b728 | Frommi | 2017-08-16T10:11:09 | in_size now updates before callback; moved output flush to method | diff --git a/src/tdef/mod.rs b/src/tdef/mod.rs
index 2012bf9..300be95 100644
--- a/src/tdef/mod.rs
+++ b/src/tdef/mod.rs
@@ -168,27 +168,30 @@ pub unsafe extern "C" fn tdefl_compress(
out_size: Option<&mut usize>,
flush: TDEFLFlush,
) -> TDEFLStatus {
- let in_buf_size = in_size.as_ref().map_or(0, |size| ... | 2 | 134 | 94 |
1f04447781e02e4fbb50a8563dd4fa72671e4855 | Frommi | 2017-08-15T14:28:12 | remove closure in find_match | diff --git a/src/tdef/tdef_oxide.rs b/src/tdef/tdef_oxide.rs
index 4684008..c471376 100644
--- a/src/tdef/tdef_oxide.rs
+++ b/src/tdef/tdef_oxide.rs
@@ -535,40 +535,23 @@ impl DictOxide {
let s01: u16 = self.read_unaligned(pos as isize);
if max_match_len <= match_len { return (match_dist, match_len)... | 1 | 7 | 22 |
c4ff58fa12640c57527fc4330150a39562849772 | Frommi | 2017-08-15T14:16:03 | tinfl renames | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index 98da842..f72721a 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -327,7 +327,7 @@ pub fn mz_inflate_init2_oxide(stream_oxide: &mut StreamOxide<inflate_state>,
stream_oxide.state.alloc_state::<inflate_state>()?;
let state = stream_oxide.state.as_... | 2 | 32 | 30 |
36a100c0fda186a3c67426ac43e3ea6cd99792df | Frommi | 2017-08-15T14:14:37 | rearrangement | diff --git a/src/tdef/tdef_oxide.rs b/src/tdef/tdef_oxide.rs
index f8db552..4684008 100644
--- a/src/tdef/tdef_oxide.rs
+++ b/src/tdef/tdef_oxide.rs
@@ -13,6 +13,31 @@ pub struct CompressorOxide {
pub dict: DictOxide,
}
+impl CompressorOxide {
+ pub fn new(callback_func: Option<CallbackFunc>, flags: u32) -> ... | 1 | 113 | 114 |
7c3eadcb6c691085a8aa59ee4fd9af021acbb50e | Frommi | 2017-08-15T13:56:45 | c_int/c_uint -> i32/u32 | diff --git a/src/lib.rs b/src/lib.rs
index 5e6e898..2bbc4f9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,8 +26,6 @@ pub use tdef::{
#[allow(bad_style)]
type tdefl_compressor = tdef::CompressorOxide;
-#[allow(bad_style)]
-type tdefl_put_buf_func_ptr = PutBufFuncPtr;
mod tinfl;
pub use tinfl::tinfl_decompresso... | 5 | 122 | 125 |
b0d916d2c694494dc55e10d5856aa8ca3b815d32 | Frommi | 2017-08-15T11:57:07 | refactor now redundant tdefl_ and _oxide | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index af0c4e8..ec07a84 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -1,7 +1,6 @@
use super::*;
use tdef::TDEFL_COMPUTE_ADLER32;
-use tdef::tdefl_get_adler32_oxide;
use tdef::TDEFLStatus;
use tdef::TDEFLFlush;
@@ -196,7 +195,7 @@ pub fn mz_deflate_init2... | 4 | 142 | 155 |
1d57134e3090284b08787a83b1e175e11f3dd472 | oyvindln | 2017-08-14T23:38:47 | Make length rle slightly more readable | diff --git a/src/build.rs b/src/build.rs
index 18b2502..e7ca9e0 100644
--- a/src/build.rs
+++ b/src/build.rs
@@ -1,7 +1,5 @@
extern crate gcc;
-use std::process::Command;
-
#[cfg(not(feature = "fuzzing"))]
fn main() {
gcc::compile_library("libminiz.a",
@@ -13,6 +11,8 @@ fn main() {
#[cfg(feature = "fuzzing... | 2 | 82 | 60 |
f3c977f8815b1bc0ce03f38978de0a090a2bfce0 | Frommi | 2017-08-14T17:57:00 | minor style; redundant unsafe | diff --git a/src/tdef/tdef_oxide.rs b/src/tdef/tdef_oxide.rs
index ed2776a..e9d6c29 100644
--- a/src/tdef/tdef_oxide.rs
+++ b/src/tdef/tdef_oxide.rs
@@ -32,7 +32,7 @@ impl<'a> CallbackOut<'a> {
pub fn new_output_buffer<'b>(
&'b mut self,
local_buf: &'b mut [u8],
- out_buf_ofs: usize
+ ... | 1 | 56 | 56 |
f13c07ce326ee05d0c7879dab336f4d1fd69ac1b | Frommi | 2017-08-14T17:36:46 | minor style; u32 positions in find_match | diff --git a/src/tdef/tdef_oxide.rs b/src/tdef/tdef_oxide.rs
index 673918d..ed2776a 100644
--- a/src/tdef/tdef_oxide.rs
+++ b/src/tdef/tdef_oxide.rs
@@ -1005,13 +1005,15 @@ pub fn tdefl_find_match_oxide(
if read_unaligned_dict::<u16>(&dict.dict[..], probe_pos as isize) != s01 { continue }
let mut pr... | 1 | 6 | 4 |
06ed28c71f4976bad78f1009a4e42ebe194787a7 | Frommi | 2017-08-14T09:39:55 | style; wrapping_add | diff --git a/src/tdef/tdef_oxide.rs b/src/tdef/tdef_oxide.rs
index 4e4f242..673918d 100644
--- a/src/tdef/tdef_oxide.rs
+++ b/src/tdef/tdef_oxide.rs
@@ -261,7 +261,6 @@ impl LZOxide {
}
pub fn write_code(&mut self, val: u8) {
- // TODO: uncheck slice get
self.codes[self.code_position] = val;... | 1 | 31 | 59 |
7883996bdddef372a40243b6897a7b20499bd2f8 | Frommi | 2017-08-07T10:47:33 | wrapping sub | diff --git a/src/tdef/tdef_oxide.rs b/src/tdef/tdef_oxide.rs
index 4ac19e5..fe05a9f 100644
--- a/src/tdef/tdef_oxide.rs
+++ b/src/tdef/tdef_oxide.rs
@@ -1075,7 +1075,7 @@ pub fn tdefl_compress_normal_oxide(h: &mut HuffmanOxide,
let cur_pos = dict.lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK;
if p.flags & (... | 1 | 1 | 1 |
907eaf71a1e848b2b366c43795cbfd4b0b9327e2 | Frommi | 2017-08-02T09:52:31 | sturct arg in tdefl_compress_block | diff --git a/src/tdef/mod.rs b/src/tdef/mod.rs
index 655fc84..cdd1507 100644
--- a/src/tdef/mod.rs
+++ b/src/tdef/mod.rs
@@ -274,12 +274,11 @@ pub unsafe extern "C" fn tdefl_start_static_block(d: *mut tdefl_compressor) {
#[no_mangle]
pub unsafe extern "C" fn tdefl_compress_lz_codes(d: *mut tdefl_compressor) -> bool {... | 2 | 7 | 9 |
d84612d52e77aa21d07edb14583683e038d850f9 | Frommi | 2017-08-01T16:09:44 | new new new | diff --git a/src/tdef/mod.rs b/src/tdef/mod.rs
index ffae824..655fc84 100644
--- a/src/tdef/mod.rs
+++ b/src/tdef/mod.rs
@@ -245,14 +245,7 @@ pub unsafe extern "C" fn tdefl_optimize_huffman_table(d: *mut tdefl_compressor,
code_size_limit: c_int,
... | 2 | 60 | 139 |
d9721e388a383698222eb1852129109196724f54 | Frommi | 2017-07-31T10:33:30 | tdefl_compress_block_oxide | diff --git a/src/tdef/mod.rs b/src/tdef/mod.rs
index 0a156ce..caf82ff 100644
--- a/src/tdef/mod.rs
+++ b/src/tdef/mod.rs
@@ -292,7 +292,7 @@ pub unsafe extern "C" fn tdefl_start_static_block(d: *mut tdefl_compressor) {
let mut len = d.m_pOutput_buf_end as usize - d.m_pOutput_buf as usize;
let mut cursor = C... | 2 | 44 | 12 |
0a6c113d70d40f44549aca5f1fd8d0cfed6bd821 | Frommi | 2017-07-25T14:17:01 | matklad:review | diff --git a/src/lib.rs b/src/lib.rs
index 17c09ae..7071b6a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,22 +1,25 @@
extern crate libc;
use std::slice;
-use self::libc::*;
use std::ptr;
use std::mem;
use std::cmp;
+use libc::*;
+
mod lib_oxide;
pub use lib_oxide::*;
mod tdef;
-pub use tdef::tdefl_radix_... | 2 | 132 | 115 |
a3f5962787e18ed72d7b10a6a6a21be6456415c1 | Frommi | 2017-07-24T12:26:17 | high-level API fuzzing | diff --git a/fuzz/fuzz_targets/fuzz_compress.rs b/fuzz/fuzz_targets/fuzz_high.rs
similarity index 100%
rename from fuzz/fuzz_targets/fuzz_compress.rs
rename to fuzz/fuzz_targets/fuzz_high.rs | 1 | 0 | 0 |
8b9d19393540476425cfd806118dc06f92207b14 | Frommi | 2017-07-19T16:08:50 | Wrong exit code in mz_deflate_oxide | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index 53fd07c..f70c4d0 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -184,7 +184,11 @@ pub fn mz_deflate_oxide(stream_oxide: &mut StreamOxide<tdefl_compressor>, flush:
}
if state.m_prev_return_status == TDEFLStatus::Done as c_int {
- return E... | 1 | 5 | 1 |
9273c11018e6d53b5f4d45e119c57f0e84f6e23e | Frommi | 2017-07-19T13:15:18 | C-struct inflate_state goes to lib.rs | diff --git a/src/lib.rs b/src/lib.rs
index 98d0c64..a943fa7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -111,6 +111,21 @@ pub type mz_alloc_func = unsafe extern "C" fn(*mut c_void, size_t, size_t) -> *m
#[allow(bad_style)]
pub type mz_free_func = unsafe extern "C" fn(*mut c_void, *mut c_void);
+#[repr(C)]
+#[allow(... | 2 | 15 | 16 |
614feba6d31c5b1994adc27061f5ef57f741d98f | Frommi | 2017-07-19T13:08:33 | allocation incapsulated into Allocator struct | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index 782b295..ac984e5 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -41,6 +41,12 @@ pub trait StateType {}
impl StateType for tdefl_compressor {}
impl StateType for inflate_state {}
+pub struct Allocator {
+ pub alloc: mz_alloc_func,
+ pub free: mz_f... | 1 | 40 | 58 |
e9c1893d4f74119b8fe3b400afddfc2368b994bb | Frommi | 2017-07-19T12:50:20 | even rustier errors: ? instead of maps and matches | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index a8b6a78..782b295 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -120,43 +120,20 @@ impl<'io, 'state, ST: StateType> StreamOxide<'io, 'state, ST> {
self.free = Some(f);
}
}
-
- pub unsafe fn use_free(&self, address: *mut c_void... | 1 | 203 | 241 |
374cee47bd47f36dc954d7bd267d0184ba09755e | Frommi | 2017-07-19T09:53:22 | minor style | diff --git a/src/lib.rs b/src/lib.rs
index bdf89d9..98d0c64 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -164,7 +164,7 @@ macro_rules! oxidize {
($mz_func:ident, $mz_func_oxide:ident; $($arg_name:ident: $type_name:ident),*) => {
#[no_mangle]
#[allow(bad_style)]
- pub unsafe extern "C" fn $m... | 2 | 12 | 6 |
fadf155576e5e2ecfaa953fa9410a3c0b9149aa0 | Frommi | 2017-07-18T15:06:01 | more enums | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index f6cdaef..b0d7e92 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -179,9 +179,8 @@ pub fn mz_compress2_oxide(stream_oxide: &mut StreamOxide<tdefl_compressor>,
use tdef::TDEFL_COMPUTE_ADLER32;
-use tdef::TDEFL_STATUS_OKAY;
-use tdef::TDEFL_STATUS_DONE;
... | 2 | 11 | 15 |
216dc35e5e423886f7ca849211df713f29a7aea8 | Frommi | 2017-07-18T13:58:20 | minor style | diff --git a/src/lib.rs b/src/lib.rs
index 61c875e..3f179d4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -74,24 +74,18 @@ extern {
#[no_mangle]
pub unsafe extern "C" fn mz_adler32(adler: c_ulong, ptr: *const u8, buf_len: usize) -> c_ulong {
- match ptr.as_ref() {
- None => MZ_ADLER32_INIT,
- Some(r)... | 2 | 15 | 21 |
96882b9779917566c1491c095c0008fd5cfc168d | Frommi | 2017-07-18T13:35:23 | remove 'Error' suffix in MZError::___Error enum | diff --git a/src/lib.rs b/src/lib.rs
index 232b993..61c875e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -38,13 +38,13 @@ pub enum MZStatus {
}
pub enum MZError {
- Errno = -1,
- StreamError = -2,
- DataError = -3,
- MemError = -4,
- BufError = -5,
- VersionError = -6,
- ParamError = -10000
+ ... | 2 | 37 | 37 |
4aa20292cfd38de818859e7c575a617c472980c6 | Frommi | 2017-07-18T13:30:59 | rustier errors | diff --git a/src/lib.rs b/src/lib.rs
index 7f70ea9..232b993 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,6 +18,9 @@ pub use tdef::tdefl_put_buf_func_ptr;
mod tinfl;
pub use tinfl::tinfl_decompressor;
+pub const MZ_DEFLATED: c_int = 8;
+pub const MZ_DEFAULT_WINDOW_BITS: c_int = 15;
+
pub const MZ_ADLER32_INIT: c... | 3 | 199 | 196 |
e4c41d168df341aae3ab6abf4ff17b6c7a671017 | Frommi | 2017-07-18T10:16:21 | extern blocks splitting to mods; tdefl_create_comp_flags_from_zip_params_oxide | diff --git a/src/lib.rs b/src/lib.rs
index 22b299e..18d45f2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -40,38 +40,25 @@ pub const MZ_PARAM_ERROR: c_int = -10000;
pub const MZ_DEFLATED: c_int = 8;
pub const MZ_DEFAULT_WINDOW_BITS: c_int = 15;
+
+pub const MZ_NO_COMPRESSION: c_int = 0;
+pub const MZ_BEST_SPEED: c_in... | 5 | 96 | 31 |
25e0eb0d23c97a5a8c2535b372967cb9cdff1ffe | Frommi | 2017-07-17T15:41:21 | minor style | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index 444f554..241032f 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -360,11 +360,6 @@ pub fn mz_inflate_init2_oxide(stream_oxide: &mut StreamOxide<inflate_state>,
}
}
-use tinfl::TINFL_FLAG_COMPUTE_ADLER32;
-use tinfl::TINFL_FLAG_PARSE_ZLIB_HEADER;
-us... | 1 | 4 | 9 |
f69df143b54bce4d4abf59a6432c01b64d28dd91 | Frommi | 2017-07-17T14:12:45 | push_dict_out for copy-paste in mz_inflate_oxide; style | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index a1f4419..444f554 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -253,14 +253,17 @@ pub fn mz_deflate_oxide(stream_oxide: &mut StreamOxide<tdefl_compressor>, flush:
loop {
let mut in_bytes = next_in.len();
... | 1 | 36 | 23 |
2c9c1d7961206262195ec958c243cd273ab60e52 | Frommi | 2017-07-17T13:39:09 | rearrangement; write mz_stream -> derive Debug | diff --git a/src/lib.rs b/src/lib.rs
index 7a7b711..22b299e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -44,6 +44,36 @@ pub const MZ_DEFAULT_STRATEGY: c_int = 0;
pub const MZ_DEFAULT_COMPRESSION: c_int = 6;
+#[allow(bad_style)]
+extern {
+ pub fn miniz_def_alloc_func(opaque: *mut c_void, items: size_t, size: si... | 2 | 77 | 98 |
1a7c73dd5c39a9b252cdcbc2ca923e4374ed5e88 | Frommi | 2017-07-17T13:25:33 | minor style | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index 18a6f50..673a031 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -159,9 +159,9 @@ pub fn mz_compress2_oxide(stream_oxide: &mut StreamOxide<tdefl_compressor>,
return if status == MZ_OK { MZ_BUF_ERROR } else { status };
}
- let res = mz_def... | 1 | 7 | 7 |
38652200c82791d0191ab8ece4f32d6e2ebfc086 | Frommi | 2017-07-17T12:36:53 | style change for long fn's | diff --git a/src/lib.rs b/src/lib.rs
index ec6a3c1..7a7b711 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -149,14 +149,28 @@ extern {
pub fn miniz_def_alloc_func(opaque: *mut c_void, items: size_t, size: size_t) -> *mut c_void;
pub fn miniz_def_free_func(opaque: *mut c_void, address: *mut c_void);
- pub fn... | 4 | 55 | 24 |
0b00b4e1c0d0d312123dc9394e4584eee780353f | Frommi | 2017-07-17T12:29:35 | oxidize! macro for repetitive wrapper-functions | diff --git a/src/lib.rs b/src/lib.rs
index 9500c6e..ec6a3c1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -160,6 +160,25 @@ extern {
decomp_flags: c_uint) -> c_int;
}
+macro_rules! oxidize {
+ ($mz_func:ident, $mz_func_oxide:ident, $($arg_name:ident: $type_name:ident),*) => {
+ #... | 1 | 30 | 96 |
1176e6277e8d49f76cc242bbfb6f14757b6528c1 | Frommi | 2017-07-14T13:35:00 | minor style | diff --git a/src/lib_oxide.rs b/src/lib_oxide.rs
index bfaf897..d1d5008 100644
--- a/src/lib_oxide.rs
+++ b/src/lib_oxide.rs
@@ -482,7 +482,7 @@ pub fn mz_inflate_end_oxide(stream_oxide: &mut StreamOxide<inflate_state>) -> c_
// TODO: probably not covered by tests
pub fn mz_deflate_reset_oxide(stream_oxide: &mut Stre... | 1 | 1 | 1 |
6ea487b819042028062816c348299af7c438a622 | Frommi | 2017-07-13T09:03:21 | mz_stream wrapper -> Rust struct | diff --git a/src/lib.rs b/src/lib.rs
index 498e4b6..63dab4b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -81,6 +81,27 @@ pub struct mz_stream {
pub reserved: c_ulong,
}
+pub fn write_mz_stream(stream: &mz_stream) {
+ println!("next_in: {}", stream.next_in as usize);
+ println!("avail_in: {}", stream.avail_... | 4 | 208 | 72 |
a22ffb8394493b936cb93f32bc188b3031405270 | Frommi | 2017-07-11T12:17:45 | tdef oxide file refactor | diff --git a/src/tdef.rs b/src/tdef/mod.rs
similarity index 80%
rename from src/tdef.rs
rename to src/tdef/mod.rs
index 2578e2c..76b024a 100644
--- a/src/tdef.rs
+++ b/src/tdef/mod.rs
@@ -2,6 +2,9 @@
extern crate libc;
+mod tdef_oxide;
+pub use self::tdef_oxide::tdefl_radix_sort_syms_oxide;
+
use self::libc::*;
... | 2 | 40 | 36 |
b1644a8cd050fe9c36d73d136b1e414644eccd63 | Frommi | 2017-07-11T11:13:41 | refactor: part of lib to lib_oxide; reduce -> as_mz | diff --git a/src/lib.rs b/src/lib.rs
index 432a20a..498e4b6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,11 +5,15 @@ use self::libc::*;
use std::ptr;
use std::mem;
+mod lib_oxide;
+pub use lib_oxide::*;
+
mod tdef;
pub use tdef::tdefl_radix_sort_syms;
pub use tdef::tdefl_compressor;
pub use tdef::tdefl_put_bu... | 3 | 103 | 92 |
31ce5a755f0143472b9de00b142ae946859b9d18 | Frommi | 2017-07-11T09:57:56 | del tmp comment | diff --git a/src/lib.rs b/src/lib.rs
index 33393f2..432a20a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -248,39 +248,3 @@ pub fn mz_deflate_init2_oxide(stream_oxide: &mut StreamOxide, level: c_int, meth
MZ_OK
}
-
-//int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, i... | 1 | 0 | 36 |
4fccef502eede32258a4bf0672bba64905669808 | Frommi | 2017-07-11T09:53:28 | del one unsafe | diff --git a/src/lib.rs b/src/lib.rs
index eaaf814..33393f2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -166,7 +166,7 @@ pub unsafe extern "C" fn mz_compress2(pDest: *mut u8, pDest_len: *mut c_ulong, p
}
pub fn mz_compress2_oxide(stream_oxide: &mut StreamOxide, level: c_int) -> c_int {
- let mut status: c_int = ... | 1 | 5 | 1 |
a6dfde7bffa5956dfa0544b7a201f4641ea90a91 | Frommi | 2017-07-10T15:44:47 | stream oxide; build bug fixed | diff --git a/src/build.rs b/src/build.rs
index 730270b..63dbd44 100644
--- a/src/build.rs
+++ b/src/build.rs
@@ -4,10 +4,8 @@ use std::process::Command;
#[cfg(not(feature="afl_test"))]
fn main() {
- gcc::compile_library("bin/libminiz.a",
+ gcc::compile_library("libminiz.a",
&["miniz.... | 2 | 53 | 40 |
0f3f5da9bdec0d811f9a344e3cb9c033b15df20b | Andrew Gallant | 2026-02-27T14:30:47 | api: document a couple panicking preconditions
This brings the API documentation for `Span::offset` and
`packed::Searcher::find_in` into consistency with `Input::span`. That
is, if you try to set offsets that are incorrect for the provided
haystack (or are pathologically invalid), then you get a panic. This
mimics how... | diff --git a/src/packed/api.rs b/src/packed/api.rs
index 35ebf7e..6bea99e 100644
--- a/src/packed/api.rs
+++ b/src/packed/api.rs
@@ -502,6 +502,10 @@ impl Searcher {
/// `0`) in which it was added. The offsets in the `Match` will be relative
/// to the start of `haystack` (and not `at`).
///
+ /// # P... | 2 | 16 | 1 |
e88e1fce8f7c2073488842cf8cd3d322329e012b | Andrew Gallant | 2026-02-11T17:04:55 | benchmarks: bump dependencies | diff --git a/benchmarks/engines/rust-aho-corasick/Cargo.lock b/benchmarks/engines/rust-aho-corasick/Cargo.lock
index 7829c27..8082e11 100644
--- a/benchmarks/engines/rust-aho-corasick/Cargo.lock
+++ b/benchmarks/engines/rust-aho-corasick/Cargo.lock
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# I... | 1 | 3 | 3 |
b58556ea5aac5a61a6094f93c3a2398198cb907e | Joshua Barretto | 2025-10-28T21:09:32 | doc: switch from `doc_auto_cfg` to `doc_cfg`
The feature was renamed.
PR #165 | diff --git a/Cargo.toml b/Cargo.toml
index c9ad16d..79bf680 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -60,7 +60,7 @@ doc-comment = "0.3.3"
all-features = true
# This opts into a nightly unstable option to show the features that need to be
# enabled for public API items. To do that, we set 'docsrs', and when that's... | 2 | 2 | 2 |
1adf588b6aa778dcd97faa4e3752d569ebf5b4f7 | Andrew Gallant | 2024-09-25T20:44:00 | benchmarks: update deps | diff --git a/benchmarks/engines/rust-aho-corasick/Cargo.lock b/benchmarks/engines/rust-aho-corasick/Cargo.lock
index 01a540c..7829c27 100644
--- a/benchmarks/engines/rust-aho-corasick/Cargo.lock
+++ b/benchmarks/engines/rust-aho-corasick/Cargo.lock
@@ -13,7 +13,7 @@ dependencies = [
[[package]]
name = "aho-corasick... | 1 | 2 | 2 |
cd400ad792d6888cc8fa4c1f9e2493b519961b3c | Akmal | 2024-03-27T20:37:31 | lint: resolve a few Clippy warnings
These changes only reflect a subset that I agreed with.
PR #135 | diff --git a/src/dfa.rs b/src/dfa.rs
index eabd15b..1aa4f0e 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -494,7 +494,7 @@ impl Builder {
matches: vec![vec![]; num_match_states],
matches_memory_usage: 0,
pattern_lens: nnfa.pattern_lens_raw().to_vec(),
- prefilter: nnfa.pr... | 5 | 9 | 9 |
1b64b2251c684ebf37d1dfffe61440d98ff048d5 | he32 | 2024-03-20T00:05:54 | simd: fix big-endian aarch64 build
If I've understood correctly, the "neon" feature is not available
in big-endian mode on aarch64. Despite this, I need to test for
both "neon" feature and endian-ness to make this build.
This overall feels like a suspicious change to me. It would also
be better if we could test... | diff --git a/src/packed/teddy/builder.rs b/src/packed/teddy/builder.rs
index be91777..e9bb68b 100644
--- a/src/packed/teddy/builder.rs
+++ b/src/packed/teddy/builder.rs
@@ -230,7 +230,11 @@ impl Builder {
}
}
}
- #[cfg(target_arch = "aarch64")]
+ #[cfg(all(
+ ... | 2 | 20 | 4 |
59b365543d01409959bb93a20a28fb34ff532c03 | Andrew Gallant | 2024-02-26T01:39:00 | style: clean up lint violations | diff --git a/src/packed/vector.rs b/src/packed/vector.rs
index ed3f890..7140bd2 100644
--- a/src/packed/vector.rs
+++ b/src/packed/vector.rs
@@ -89,6 +89,7 @@ pub(crate) trait Vector:
///
/// Callers must ensure that this is okay to call in the current target for
/// the current CPU.
+ #[allow(dead_co... | 2 | 5 | 10 |
964a2d5431d099d70e770fd4c19e51dfbb389252 | Andrew Gallant | 2023-10-09T14:21:05 | benchmarks: update aho-corasick engine lock file | diff --git a/benchmarks/engines/rust-aho-corasick/Cargo.lock b/benchmarks/engines/rust-aho-corasick/Cargo.lock
index d42c1cf..01a540c 100644
--- a/benchmarks/engines/rust-aho-corasick/Cargo.lock
+++ b/benchmarks/engines/rust-aho-corasick/Cargo.lock
@@ -13,7 +13,7 @@ dependencies = [
[[package]]
name = "aho-corasick... | 1 | 2 | 2 |
0c3802f2c8164bb77be216cd8dcd316ec9e1a331 | Andrew Gallant | 2023-10-09T14:16:06 | dfa: fix performance bug when building a DFA
This bug has existed since the 1.0 release (I believe), but was
exacerbated when I changed the non-contiguous NFA to use a linked list
for its sparse transitions. In that change, I made it so the special
sentinel DEAD and FAIL states didn't get densified to save on memory. ... | diff --git a/src/dfa.rs b/src/dfa.rs
index 19020a6..eabd15b 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -566,16 +566,19 @@ impl Builder {
if oldnextsid == noncontiguous::NFA::FAIL {
if anchored.is_anchored() {
oldnextsid = noncontiguous::NFA::DE... | 1 | 23 | 11 |
12025c561af747fd74c7a745e03d7e21c15f5584 | Andrew Gallant | 2023-10-09T02:01:46 | doc: add a FIXME about a perf problem
I noticed this when running the rebar benchmarks. Some of the DFA
compilation benchmarks seem to have regressed. | diff --git a/src/dfa.rs b/src/dfa.rs
index f0370a6..19020a6 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -567,6 +567,15 @@ impl Builder {
if anchored.is_anchored() {
oldnextsid = noncontiguous::NFA::DEAD;
} else {
+ ... | 1 | 9 | 0 |
3c811c294e09880ded4edc4e35bf9f923e8979af | Andrew Gallant | 2023-09-20T13:12:14 | teddy: replace _mm_extract_epi64 with transmute
It turns out that _mm_extract_epi64 requires SSE 4.1. While it would be
fine to just require that (virtually all CPUs have it available), the
rest of Teddy only requires SSSE3. I don't love bumping the mininum
required just to get the lanes out of a vector. So just repla... | diff --git a/src/packed/vector.rs b/src/packed/vector.rs
index f19b86c..ed3f890 100644
--- a/src/packed/vector.rs
+++ b/src/packed/vector.rs
@@ -320,7 +320,7 @@ pub(crate) trait FatVector: Vector {
mod x86_64_ssse3 {
use core::arch::x86_64::*;
- use crate::util::int::{I32, I64, I8};
+ use crate::util::int... | 1 | 7 | 5 |
9c2d30aa2010cbe58a5b9ae1179a8174a54820f6 | Andrew Gallant | 2023-09-05T14:56:49 | packed: move old vector helpers aside
We're going to replace it with a Vector trait that can be implemented
for multiple vector types. Similar to what was done with memchr[1].
Before doing that, we move the old stuff aside.
[1]: https://github.com/BurntSushi/memchr/blob/f6188dbbca2b529100852e4509d48d2d002a674a/src/v... | diff --git a/src/packed/mod.rs b/src/packed/mod.rs
index 9235df6..1c4120d 100644
--- a/src/packed/mod.rs
+++ b/src/packed/mod.rs
@@ -113,4 +113,4 @@ mod teddy;
#[cfg(all(feature = "std", test))]
mod tests;
#[cfg(all(feature = "std", target_arch = "x86_64"))]
-mod vector;
+mod vectorold;
diff --git a/src/packed/teddy... | 3 | 86 | 83 |
3ae537cd1ca7de6897984cb7b666935c19c8c0fb | Andrew Gallant | 2023-08-29T17:53:12 | lint: get rid of 'allow(warnings)' and fix fallout
I added this while hacking around in the non-contiguous NFA for the
1.0.4 release and forgot to remove it. So we do a little clean-up. | diff --git a/src/dfa.rs b/src/dfa.rs
index b60bf9c..f0370a6 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -173,8 +173,6 @@ impl DFA {
sid: StateID,
pids: impl Iterator<Item = PatternID>,
) {
- use core::mem::size_of;
-
let index = (sid.as_usize() >> self.stride2).checked_sub(2).unwr... | 3 | 14 | 26 |
776b0910a5061213815b0c18c08a173b909c744a | Andrew Gallant | 2023-08-29T17:43:21 | nfa: improve construction times for small automatons
It turns out that #121 introduced a relatively sizeable performance
regression when building very small automatons. Namely, several of the
steps in the construction process took worst case `O(n^2)` time, where
`n` corresponds to the alphabet size (255 in this case).... | diff --git a/src/nfa/noncontiguous.rs b/src/nfa/noncontiguous.rs
index dda6aa8..b18ec47 100644
--- a/src/nfa/noncontiguous.rs
+++ b/src/nfa/noncontiguous.rs
@@ -309,25 +309,27 @@ impl NFA {
})
}
- /// Return the transition following the one given. If the one given is the
- /// last transition for ... | 1 | 101 | 40 |
31bb1fc30da69ab8575483c55e15384d09f4c88d | Andrew Gallant | 2023-08-14T15:15:55 | nfa/noncontiguous: use a linked list to represent transitions
This completely re-works how transitions are represented in a
non-contiguous NFA. As a result, we improve search times, decrease heap
requirements for an NFA by about half and decrease peak memory usage by
about two thirds.
The essential difference here is... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index edaafa7..2947627 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1996,7 +1996,7 @@ impl AhoCorasick {
/// .ascii_case_insensitive(true)
/// .build(&["foobar", "bruce", "triskaidekaphobia", "springsteen"])
/// .unwrap();
-... | 2 | 477 | 173 |
ba085aa97980750456700c84443304c119f9e783 | Andrew Gallant | 2023-08-14T15:12:33 | aho-corasick-debug: tweak default dense depth value
The issue here is that now both the non-contiguous and contiguous NFAs
support a dense depth option, but they want different default values. I
ended up increasing this by 1 to match the default value for the
non-contiguous NFA because it can imporve search times quit... | diff --git a/aho-corasick-debug/main.rs b/aho-corasick-debug/main.rs
index 68f27f3..b3e4241 100644
--- a/aho-corasick-debug/main.rs
+++ b/aho-corasick-debug/main.rs
@@ -87,7 +87,7 @@ impl Args {
.arg(
Arg::with_name("dense-depth")
.long("dense-depth")
- ... | 1 | 1 | 1 |
4b5481576432884df09a54ec23469c69ef1f8582 | Andrew Gallant | 2023-08-11T18:40:27 | nfa/noncontiguous: use 'repr(packed)' on 'Transition'
This winds up being a modest savings in heap memory usage. If we fail in
our experiment to change how transitions are represented, we can at
least bank this more modest win.
Interestingly, the 'repr(packed)' attribute could be applied without any
changes. We just ... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 8d0f788..edaafa7 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1996,7 +1996,7 @@ impl AhoCorasick {
/// .ascii_case_insensitive(true)
/// .build(&["foobar", "bruce", "triskaidekaphobia", "springsteen"])
/// .unwrap();
-... | 2 | 2 | 1 |
25327243d2e597b79eaf927189ce7546c2a1d45d | Andrew Gallant | 2023-08-10T20:29:40 | nfa/noncontiguous: refactor to encapsulate state transitions
This commit refactors the non-contiguous NFA such that its state
transitions must be computed by using the NFA itself and not by using a
`State` directly.
Construction and search time remain roughly the same here. No obvious
difference could be seen in ad h... | diff --git a/src/dfa.rs b/src/dfa.rs
index c58d149..b60bf9c 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -168,13 +168,21 @@ impl DFA {
/// Adds the given pattern IDs as matches to the given state and also
/// records the added memory usage.
- fn set_matches(&mut self, sid: StateID, pids: &[PatternID]) {
+... | 4 | 255 | 156 |
474393be8d6be7418699e0a9ef8e00fe2fd9cd75 | Andrew Gallant | 2023-08-10T02:22:06 | nfa,dfa: call shrink_to_vec in places
This commit reduces the *actual* heap memory used by noncontiguous
NFAs, contiguous NFAs and DFAs. Previously, all three would report
memory usage that only included what was actually being used within
each Vec. But each Vec might actually have a lot more heap memory
inside of it ... | diff --git a/src/dfa.rs b/src/dfa.rs
index dd79079..c58d149 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -518,6 +518,18 @@ impl Builder {
dfa.byte_classes.alphabet_len(),
dfa.byte_classes.stride(),
);
+ // The vectors can grow ~twice as big during construction because a
+ ... | 3 | 19 | 1 |
e27da6435c629c502fda8c5099aff6e6ce7c9b72 | Andrew Gallant | 2023-08-10T02:16:41 | nfa/noncontiguous: fix memory usage reporting
Previously the heap usage required for storing the lengths of each
pattern was not included in the memory usage reported. | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 9110f4f..8d0f788 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1996,7 +1996,7 @@ impl AhoCorasick {
/// .ascii_case_insensitive(true)
/// .build(&["foobar", "bruce", "triskaidekaphobia", "springsteen"])
/// .unwrap();
-... | 2 | 2 | 1 |
fcfef4114681b09ecc1d187ecfc0b96c9bdc27c1 | Andrew Gallant | 2023-08-10T02:15:55 | dfa: fix docs for memory representation
I think I started with a contiguous representation but switched to
nested allocs. Which is kind of unfortunate, and I'd like to fix that,
but for now we should document reality. | diff --git a/src/dfa.rs b/src/dfa.rs
index 33e611d..dd79079 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -93,15 +93,9 @@ pub struct DFA {
/// instead of the IDs being 0, 1, 2, 3, ..., they are 0*stride, 1*stride,
/// 2*stride, 3*stride, ...
trans: Vec<StateID>,
- /// The matches for every match state i... | 1 | 3 | 9 |
8d735471fc12f0ca570cead8e17342274fae6331 | Guillaume Gomez | 2023-07-14T18:37:19 | docs.rs: add --generate-link-to-definition flag
This enables "jump to definition" functionality in the
source code view of rustdoc.
PR #119 | diff --git a/Cargo.toml b/Cargo.toml
index 0b8a5f5..86fa749 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -65,7 +65,7 @@ all-features = true
# To test this locally, run:
#
# RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features
-rustdoc-args = ["--cfg", "docsrs"]
+rustdoc-args = ["--cfg", "docsrs", "--gene... | 1 | 1 | 1 |
7fa9083dd1f0ce94b8608bd52bbd6bce2991a9f2 | Andrew Gallant | 2023-06-04T13:30:44 | test: fix memory usage tests
The specific values can change depending on pointer size, so we just
skip them for non-64-bit targets.
Fixes #116 | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 88e6536..9110f4f 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1975,6 +1975,7 @@ impl AhoCorasick {
/// configurations:
///
/// ```
+ /// # if !cfg!(target_pointer_width = "64") { return; }
/// use aho_corasick::{AhoCorasic... | 1 | 1 | 0 |
b91b78560d4f271426e9ce5c26681ef3b32aec76 | Andrew Gallant | 2023-06-04T12:55:19 | nfa/contiguous: gate 'swar' test
The 'swar' test is apparently sensitive to endianness. The test is just
about demonstrating a technique I had tried but didn't work out for perf
reasons. It's good to keep it, but let's just gate it on little-endian
targets.
Fixes #117 | diff --git a/src/nfa/contiguous.rs b/src/nfa/contiguous.rs
index 44bab4d..5d0c82d 100644
--- a/src/nfa/contiguous.rs
+++ b/src/nfa/contiguous.rs
@@ -1074,8 +1074,6 @@ fn u32_len(ntrans: usize) -> usize {
#[cfg(test)]
mod tests {
- use super::*;
-
// This test demonstrates a SWAR technique I tried in the spa... | 1 | 6 | 2 |
88e6bd90740e9fea6b2124778dddb8bded88e0f4 | Andrew Gallant | 2023-05-25T14:48:13 | lint: remove unnecessary 'mut' binding
It looks like rustc didn't detect this before. | diff --git a/src/dfa.rs b/src/dfa.rs
index e6f4314..33e611d 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -569,7 +569,7 @@ impl Builder {
// Now that we've remapped all the IDs in our states, all that's left
// is remapping the special state IDs.
let old = nnfa.special();
- let mut new =... | 2 | 3 | 3 |
beb163a62eaa5a4d1cf71054451371668e1e7654 | Andrew Gallant | 2023-04-17T15:43:54 | cargo: add note about plans for 'fst' integration | diff --git a/Cargo.toml b/Cargo.toml
index fcc28d9..31d5721 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -41,6 +41,10 @@ logging = ["dep:log"]
# you can copy the (very small) src/transducer.rs file to your tree. It
# specifically does not use any private APIs and should work after replacing
# 'crate::' with 'aho_cora... | 1 | 4 | 0 |
7edd3498722231f5c601ef5ae77e57233b071947 | Andrew Gallant | 2023-04-15T12:53:15 | api: seal the Automaton trait
I originally didn't intend to do this, but the Automaton trait has grown
quite large. It seems unlikely/impractical for others to meaningfully
implement it. In exchange, sealing the trait means we can add new
required methods while retaining backwards compatibility.
For the most part, th... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 0e5a8f2..88e6536 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -2648,6 +2648,8 @@ impl<A> AcAutomaton for A where
{
}
+impl crate::automaton::private::Sealed for Arc<dyn AcAutomaton> {}
+
// I'm not sure why this trait impl shows up in the do... | 2 | 25 | 1 |
f59744598b8cef44d38053750700990ba30f0828 | Andrew Gallant | 2023-04-04T15:55:50 | doc: tweak docs for perf-literal crate feature
Ref https://github.com/BurntSushi/aho-corasick/issues/108#issuecomment-1492823546 | diff --git a/src/lib.rs b/src/lib.rs
index 4af999e..20e8b81 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -214,11 +214,11 @@ this crate can be used without the standard library.
but generally only apply when the number of patterns is small (less than
~100).
* **perf-literal** -
- Enables support for prefilters th... | 1 | 5 | 5 |
b99c36e2f39431f54c557f36a04111bebb769d58 | Andrew Gallant | 2023-04-04T15:50:06 | doc: a variety of improvements
Ref https://github.com/BurntSushi/aho-corasick/issues/108#issuecomment-1489239160 | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 0b50ffd..0e5a8f2 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -46,9 +46,14 @@ use crate::{
/// randomly selected titles from Wikipedia:
///
/// * 99MB for a [`noncontiguous::NFA`] in 240ms.
-/// * 15MB for a [`contiguous::NFA`] in 275ms.
+/// ... | 5 | 45 | 20 |
1004246d56a1c6354d0267a99cff7d0915c81d8f | Andrew Gallant | 2023-04-04T14:53:17 | doc: 'std' also enables the stream search APIs
Ref https://github.com/BurntSushi/aho-corasick/issues/108#issuecomment-1489239160 | diff --git a/src/lib.rs b/src/lib.rs
index dd27135..4af999e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -205,12 +205,14 @@ This crate exposes a few features for controlling dependency usage and whether
this crate can be used without the standard library.
* **std** -
- Enables support for the standard library. This... | 1 | 8 | 6 |
74afa893e1f0723cbda9774d2fd135a93d9130bf | Andrew Gallant | 2023-03-28T11:33:06 | impl: clean up some of the 'allow' directives | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 2f6db77..82a42ed 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -2166,11 +2166,10 @@ impl AhoCorasickBuilder {
debug!("chose a DFA");
return Arc::new(dfa);
}
- #[allow(unused... | 3 | 12 | 24 |
c88cf359f9c853986d7c182b013f5c6d81af10c3 | Andrew Gallant | 2023-03-23T01:18:30 | nfa/contiguous: expand utility of contiguous NFA at cost of memory
This commit does some surgery on the in memory representation of
the contiguous NFA. Previously, we had been packing both the next
transition ID and the byte corresponding to that transition into a
single u32. In order to achieve that, we placed a rest... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index fac9ead..2f6db77 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1947,7 +1947,7 @@ impl AhoCorasick {
/// .ascii_case_insensitive(true)
/// .build(&["foobar", "bruce", "triskaidekaphobia", "springsteen"])
/// .unwrap();
-... | 3 | 268 | 134 |
b26ce9054485ec5ad28f6ced10d3303335bcf274 | Andrew Gallant | 2023-03-21T01:20:22 | api: un-export StreamChunkIter
I never meant to export this. Thank goodness I caught it before 1.0.
Sheesh. | diff --git a/src/automaton.rs b/src/automaton.rs
index 5a71076..c020a9d 100644
--- a/src/automaton.rs
+++ b/src/automaton.rs
@@ -1015,7 +1015,7 @@ impl<'a, A: Automaton, R: std::io::Read> Iterator
/// chunks it can copy and which it needs to replace.
#[cfg(feature = "std")]
#[derive(Debug)]
-pub struct StreamChunkIt... | 1 | 1 | 1 |
1f91b5011ff08e243fa7e523998a65c81ee98c92 | Andrew Gallant | 2023-03-10T13:02:56 | impl: rework stream searching
Basically, we:
1. Add 'min_pattern_len' to complement 'max_pattern_len'.
2. Rewrite stream search to be less convuleted by just walking the
automaton ourselves.
3. Ban stream searching when the automaton contains an empty pattern.
I did (3) because it greatly simplifies the implement... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 417bd50..fac9ead 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1847,6 +1847,32 @@ impl AhoCorasick {
self.aut.match_kind()
}
+ /// Returns the length of the shortest pattern matched by this automaton.
+ ///
+ /// # Exampl... | 9 | 347 | 171 |
86fdfecaf66330b2cebb4ad6b47d0ff7ece60674 | Andrew Gallant | 2023-03-10T04:07:45 | api: use 'Anchored' instead of 'Input' for 'start_state'
I think it was probably a little silly to try and use 'Input'
here. I think I was trying to copy regex-automata too much. In
aho-corasick, all we need is the anchor mode since we don't care
about look-around here.
This also makes a lot of the calls more sensibl... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 3b24017..417bd50 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -2574,8 +2574,8 @@ impl<A> AcAutomaton for A where
#[doc(hidden)]
unsafe impl Automaton for Arc<dyn AcAutomaton> {
#[inline(always)]
- fn start_state(&self, input: &Input<'_>... | 5 | 23 | 24 |
0317ac8a366106608acc76c3aa73ae3b72039ab3 | Andrew Gallant | 2023-03-10T03:05:34 | fst: fix docs in transducer impls
I'm expecting that I'll move this stuff to the 'fst' crate and make
'aho-corasick' an optional dependency there. And do the same for
'regex-automata'. Basically, I'd just prefer not to depend on 'fst' from
these core crates.
I think the reason why I did this historically was on the o... | diff --git a/src/transducer.rs b/src/transducer.rs
index 445692e..39bb240 100644
--- a/src/transducer.rs
+++ b/src/transducer.rs
@@ -92,7 +92,7 @@ impl<A: Automaton> fst::Automaton for Unanchored<A> {
}
}
-/// Represents an unanchored Aho-Corasick search of a finite state transducer.
+/// Represents an anchored... | 1 | 1 | 1 |
a6e61c4119652e2117286578aead7d6d19da1be6 | Andrew Gallant | 2023-02-27T16:08:39 | stream: fix a bug in our stream handling
This was fixed in aho-corasick 0.7.x, but I re-introduced it in my
refactoring. Essentially, stream searching and prefilters do not mix
well. I believe it's possible to do, but it requires a fair bit more
sophistication to ensure that the results of a prefilter are correctly
sy... | diff --git a/src/automaton.rs b/src/automaton.rs
index 06bf122..abd963c 100644
--- a/src/automaton.rs
+++ b/src/automaton.rs
@@ -987,10 +987,7 @@ impl<'a, A: Automaton, R: std::io::Read> Iterator
/// I wrote this many moons ago and I no longer grok it. It's likely that it
/// is way too complicated. One wonders if it... | 2 | 57 | 13 |
2df0983e7ef76bf50e6213fee35cda87af191292 | Andrew Gallant | 2023-02-27T15:52:45 | prefilter: fix a prefilter bug
The packed prefilters determine their own pattern IDs, so when
we build prefilters, we should make sure that their pattern IDs
are in sync with the pattern IDs for the Aho-Corasick automaton. | diff --git a/src/nfa/noncontiguous.rs b/src/nfa/noncontiguous.rs
index 99e8059..73d710d 100644
--- a/src/nfa/noncontiguous.rs
+++ b/src/nfa/noncontiguous.rs
@@ -677,6 +677,21 @@ impl<'a> Compiler<'a> {
"expected number of patterns to match pattern ID"
);
self.nfa.pattern_lens.... | 2 | 16 | 5 |
d58908d7ee892193ebd3d7ff13b46812e06cf117 | Andrew Gallant | 2023-02-27T14:20:08 | doc: polish
This fixes typos and generally polishes things up. The biggest change
here is making 'Input' panic eagerly if the bounds given to it are
invalid for its haystack. I'm still not quite sure about doing things
this way, but it seems sensible. Otherwise, it's kind of just left up to
the search implementation t... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index bb6cfe8..3b24017 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -33,7 +33,7 @@ use crate::{
/// `p` is the combined length of all patterns being searched. With that
/// said, building an automaton can be fairly costly because of high constant
//... | 6 | 87 | 54 |
11db9750f447cf0085fa9dce11326bd705aa43fa | Andrew Gallant | 2023-02-27T14:19:55 | api: make the 'Automaton' trait unsafe to implement
While we don't currently utilize the safety property here, we might in
the future want to eliminate bounds checks (or other things) that depend
on the correctness of implementations of `Automaton`.
Since I don't expect people to be implementing the `Automaton` trait... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index e6f06e6..bb6cfe8 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -2563,8 +2563,11 @@ impl<A> AcAutomaton for A where
// I'm not sure why this trait impl shows up in the docs, as the AcAutomaton
// trait is not exported. So we forcefully hide it.... | 5 | 40 | 6 |
04ded231f5cdcec12aeb0bf829fa324caccb689c | Andrew Gallant | 2023-02-27T12:53:59 | deps: drop 'fst' completely
We leave the code commented out and in the tree for now, but I think
I'm going to either move it to a new crate ('fst-aho-corasick'
perhaps?) or make it an optional feature on 'fst' itself. | diff --git a/Cargo.toml b/Cargo.toml
index bf530b2..8b26af3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -52,7 +52,7 @@ memchr = { version = "2.4.0", default-features = false, optional = true }
[dev-dependencies]
doc-comment = "0.3.3"
-fst = "0.4.5"
+# fst = "0.4.5"
[package.metadata.docs.rs]
# We want to docume... | 2 | 7 | 4 |
4e7fa3b85dd3a3ce882896f1d4ee22b1f271f0b4 | Andrew Gallant | 2023-02-18T13:55:37 | packed/teddy: add support for searching 4 byte needles
It turns out that 4 byte needles can really make a difference in
some cases. In one particular case, 3 byte Teddy was being used on
Cyrillic text. The first 2 bytes of most needles corresponded to one
codepoint, while the last byte corresponding to the leading byt... | diff --git a/src/packed/teddy/compile.rs b/src/packed/teddy/compile.rs
index 0114f67..2e27e10 100644
--- a/src/packed/teddy/compile.rs
+++ b/src/packed/teddy/compile.rs
@@ -251,6 +251,51 @@ impl Builder {
),
})
}
+ (4, false, _) => {
+ debug!(... | 4 | 411 | 3 |
ee6432c0a7a1c29c2db66bb514c0e8412978375f | Andrew Gallant | 2023-02-18T13:50:54 | packed/teddy: inline a loop
In some cases, Teddy can spend a lot of time in verification, and
this seems to slightly improve codegen leading to a small perf
boost. | diff --git a/src/packed/teddy/runtime.rs b/src/packed/teddy/runtime.rs
index 45049bf..69e82f3 100644
--- a/src/packed/teddy/runtime.rs
+++ b/src/packed/teddy/runtime.rs
@@ -253,11 +253,21 @@ impl Teddy {
// Convert the candidate into 64-bit chunks, and then verify each of
// those chunks.
let... | 1 | 15 | 5 |
3a949b34adc0ee2d32d7e771f53ea56e9e1cb7fe | Andrew Gallant | 2023-02-18T13:47:40 | packed: switch 'memcmp' to use 4 bytes
This seems to help in some cases where Teddy spends a lot of time
in verification. This also matches what we do in 'memchr::memmem'.
The idea here is that we tend to search a lot of short needles,
so when we use a slower 'zip' loop for everything less than 8
bytes, we wind up doi... | diff --git a/src/packed/pattern.rs b/src/packed/pattern.rs
index 9b5c372..a0b371c 100644
--- a/src/packed/pattern.rs
+++ b/src/packed/pattern.rs
@@ -271,46 +271,59 @@ impl<'p> Pattern<'p> {
// This results in an improvement in just about every benchmark. Some
// smaller than others, but in some cases,... | 1 | 39 | 26 |
f01480bcb4a988701fb03eb7ff7fdef7c934f0a7 | Andrew Gallant | 2023-02-18T13:45:48 | packed: add some log messages
This makes it a bit clearer which packed searcher is being
selected. | diff --git a/src/packed/api.rs b/src/packed/api.rs
index cfab3c7..bc4c60d 100644
--- a/src/packed/api.rs
+++ b/src/packed/api.rs
@@ -249,6 +249,7 @@ impl Builder {
// is to force it using undocumented APIs (for tests/benchmarks).
let (search_kind, minimum_len) = match self.config.force {
... | 2 | 137 | 92 |
14b41aa00c68e0d8fe883a2d40465433fb8f5e25 | Andrew Gallant | 2023-01-10T13:41:12 | aho-corasick-debug: set debug=true
Since it's no longer part of the workspace (because of annoying MSRV
issues), this setting is no longer inherited. | diff --git a/aho-corasick-debug/Cargo.toml b/aho-corasick-debug/Cargo.toml
index 7948d81..e933e96 100644
--- a/aho-corasick-debug/Cargo.toml
+++ b/aho-corasick-debug/Cargo.toml
@@ -28,3 +28,6 @@ features = ["humantime"]
[dependencies.clap]
version = "2.34.0"
default-features = false
+
+[profile.release]
+debug = tru... | 1 | 3 | 0 |
6b6b6c4165cf5e2d3dc6b092356b9b383250dd0c | Alex Touchet | 2023-01-05T12:30:55 | msrv: set rust-version to 1.56.1
PR #100 | diff --git a/Cargo.toml b/Cargo.toml
index 8bfc368..bf530b2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,6 +12,7 @@ categories = ["text-processing"]
autotests = false
exclude = ["/aho-corasick-debug"]
edition = "2021"
+rust-version = "1.56.1"
[lib]
name = "aho_corasick" | 1 | 1 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.