File tree Expand file tree Collapse file tree 4 files changed +16
-8
lines changed
Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 22name = " libgit2-rs"
33version = " 0.1.0"
44authors = [" You <you@example.com>" ]
5- build = " build.rs "
5+ edition = " 2018 "
66
77[dependencies ]
Original file line number Diff line number Diff line change 11fn main ( ) {
2- println ! ( "cargo:rustc-link-search=native=/home/jimb/libgit2-0.25.1/build" ) ;
2+ println ! ( r "cargo:rustc-link-search=native=/home/jimb/libgit2-0.25.1/build") ;
33}
Original file line number Diff line number Diff line change 1+ #![ warn( rust_2018_idioms) ]
2+ #![ allow( elided_lifetimes_in_paths) ]
3+
14mod raw;
25
36use std:: ffi:: CStr ;
@@ -48,9 +51,12 @@ fn main() {
4851 raw:: git_repository_open ( & mut repo, path. as_ptr ( ) ) ) ;
4952
5053 let c_name = b"HEAD\0 " . as_ptr ( ) as * const c_char ;
51- let mut oid = mem:: uninitialized ( ) ;
52- check ( "looking up HEAD" ,
53- raw:: git_reference_name_to_id ( & mut oid, repo, c_name) ) ;
54+ let oid = {
55+ let mut oid = mem:: MaybeUninit :: uninit ( ) ;
56+ check ( "looking up HEAD" ,
57+ raw:: git_reference_name_to_id ( oid. as_mut_ptr ( ) , repo, c_name) ) ;
58+ oid. assume_init ( )
59+ } ;
5460
5561 let mut commit = ptr:: null_mut ( ) ;
5662 check ( "looking up commit" ,
Original file line number Diff line number Diff line change @@ -25,18 +25,20 @@ extern {
2525 pub fn git_commit_free ( commit : * mut git_commit ) ;
2626}
2727
28- pub enum git_repository { }
29- pub enum git_commit { }
28+ # [ repr ( C ) ] pub struct git_repository { _private : [ u8 ; 0 ] }
29+ # [ repr ( C ) ] pub struct git_commit { _private : [ u8 ; 0 ] }
3030
3131#[ repr( C ) ]
3232pub struct git_error {
3333 pub message : * const c_char ,
3434 pub klass : c_int
3535}
3636
37+ pub const GIT_OID_RAWSZ : usize = 20 ;
38+
3739#[ repr( C ) ]
3840pub struct git_oid {
39- pub id : [ c_uchar ; 20 ]
41+ pub id : [ c_uchar ; GIT_OID_RAWSZ ]
4042}
4143
4244pub type git_time_t = i64 ;
You can’t perform that action at this time.
0 commit comments