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
120120/// # Safety
121121/// This function is modifying a C global without synchronization, so it is not
122122/// 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 > {
124124 crate :: init ( ) ;
125125 try_call ! ( raw:: git_libgit2_opts(
126126 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> {
134134/// # Safety
135135/// This function is reading a C global without synchronization, so it is not
136136/// 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 > {
138138 crate :: init ( ) ;
139139 let mut current = 0 ;
140140 let mut allowed = 0 ;
@@ -519,4 +519,12 @@ mod test {
519519 assert ! ( get_server_timeout_in_milliseconds( ) . unwrap( ) == 10_000 ) ;
520520 }
521521 }
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+ }
522530}
You can’t perform that action at this time.
0 commit comments