Skip to content

Commit b72e773

Browse files
committed
pass best as a shared reference
1 parent dffc764 commit b72e773

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/dictBuilder/cover.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl COVER_best_t {
131131
#[repr(C)]
132132
struct COVER_tryParameters_data_t<'a, 'b> {
133133
ctx: &'b COVER_ctx_t<'a>,
134-
best: &'b mut COVER_best_t,
134+
best: &'b COVER_best_t,
135135
dictBufferCapacity: size_t,
136136
parameters: ZDICT_cover_params_t,
137137
}
@@ -970,20 +970,19 @@ pub(super) fn COVER_best_wait(
970970
best: &mut COVER_best_t,
971971
) -> std::sync::MutexGuard<'_, COVER_best_t_inner> {
972972
let mut guard = best.mutex.lock().unwrap();
973-
#[expect(clippy::while_immutable_condition)]
974973
while guard.liveJobs != 0 {
975974
guard = best.cond.wait(guard).unwrap();
976975
}
977976
guard
978977
}
979978

980-
pub(super) fn COVER_best_start(best: &mut COVER_best_t) {
979+
pub(super) fn COVER_best_start(best: &COVER_best_t) {
981980
let mut guard = best.mutex.lock().unwrap();
982981
guard.liveJobs += 1;
983982
}
984983

985984
pub(super) fn COVER_best_finish(
986-
best: &mut COVER_best_t,
985+
best: &COVER_best_t,
987986
parameters: ZDICT_cover_params_t,
988987
selection: &COVER_dictSelection_t,
989988
) {
@@ -1348,7 +1347,7 @@ pub unsafe extern "C" fn ZDICT_optimizeTrainFromBuffer_cover(
13481347

13491348
let data = Box::new(COVER_tryParameters_data_t {
13501349
ctx: &ctx,
1351-
best: &mut best,
1350+
best: &best,
13521351
dictBufferCapacity,
13531352
parameters,
13541353
});

lib/dictBuilder/fastcover.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ pub unsafe extern "C" fn ZDICT_optimizeTrainFromBuffer_fastCover(
832832
}
833833
free(data as *mut core::ffi::c_void);
834834
} else {
835-
COVER_best_start(&mut best);
835+
COVER_best_start(&best);
836836
if !pool.is_null() {
837837
POOL_add(
838838
pool,

0 commit comments

Comments
 (0)