File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ pub unsafe fn set_cache_object_limit(kind: ObjectType, size: libc::size_t) -> Re
120
120
/// # Safety
121
121
/// This function is modifying a C global without synchronization, so it is not
122
122
/// thread safe, and should only be called before any thread is spawned.
123
- pub unsafe fn set_cache_max_size ( size : libc:: size_t ) -> Result < ( ) , Error > {
123
+ pub unsafe fn set_cache_max_size ( size : libc:: ssize_t ) -> Result < ( ) , Error > {
124
124
crate :: init ( ) ;
125
125
try_call ! ( raw:: git_libgit2_opts(
126
126
raw:: GIT_OPT_SET_CACHE_MAX_SIZE as libc:: c_int,
@@ -134,7 +134,7 @@ pub unsafe fn set_cache_max_size(size: libc::size_t) -> Result<(), Error> {
134
134
/// # Safety
135
135
/// This function is reading a C global without synchronization, so it is not
136
136
/// thread safe, and should only be called before any thread is spawned.
137
- pub unsafe fn get_cached_memory ( ) -> Result < ( libc:: size_t , libc:: size_t ) , Error > {
137
+ pub unsafe fn get_cached_memory ( ) -> Result < ( libc:: ssize_t , libc:: ssize_t ) , Error > {
138
138
crate :: init ( ) ;
139
139
let mut current = 0 ;
140
140
let mut allowed = 0 ;
@@ -519,4 +519,12 @@ mod test {
519
519
assert ! ( get_server_timeout_in_milliseconds( ) . unwrap( ) == 10_000 ) ;
520
520
}
521
521
}
522
+
523
+ #[ test]
524
+ fn cache_size ( ) {
525
+ unsafe {
526
+ assert ! ( set_cache_max_size( 20 * 1024 * 1024 ) . is_ok( ) ) ;
527
+ assert ! ( get_cached_memory( ) . is_ok_and( |m| m. 1 == 20 * 1024 * 1024 ) ) ;
528
+ }
529
+ }
522
530
}
You can’t perform that action at this time.
0 commit comments