Skip to content

Commit 8f77e8a

Browse files
committed
prepare for rust-lang/rust-bindgen#603 to be fixed
1 parent e615a76 commit 8f77e8a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

c-ares-sys/ffi.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
--- src/ffi.rs.orig 2017-03-19 19:51:56.047460398 +0000
2-
+++ src/ffi.rs 2017-03-19 20:05:08.080603066 +0000
1+
--- src/ffi.rs.orig 2017-04-03 23:03:08.683728945 +0100
2+
+++ src/ffi.rs 2017-04-03 23:03:08.727729681 +0100
33
@@ -1,4 +1,12 @@
44
/* automatically generated by rust-bindgen */
55
+#![allow(non_camel_case_types, non_snake_case)]
@@ -307,7 +307,7 @@
307307
fn clone(&self) -> Self { *self }
308308
}
309309
@@ -641,28 +428,6 @@
310-
pub host: *mut ::std::os::raw::c_schar,
310+
pub host: *mut ::std::os::raw::c_char,
311311
pub priority: ::std::os::raw::c_ushort,
312312
}
313313
-#[test]

c-ares-sys/generate-ffi.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ then
66
exit 1
77
fi
88

9-
# Prepare for bindgen, do it, and then apply manual patches.
9+
# Prepare for bindgen, and do it.
1010
(cd c-ares && ./buildconf && ./configure)
1111
bindgen --whitelist-function="ares.*" --whitelist-type="ares.*" --whitelist-type="apattern" --no-recursive-whitelist --no-unstable-rust --output=src/ffi.rs c-ares/ares.h
12-
patch -p0 < ffi.patch
1312

1413
# bindgen converts 'char' to 'c_schar' - see https://github.com/servo/rust-bindgen/issues/603.
1514
# Since c-ares never uses 'signed char' we can compensate with simple search-and-replace.
1615
sed -i 's/c_schar/c_char/g' src/ffi.rs
1716

17+
# Apply manual patches.
18+
patch -p0 < ffi.patch
19+
1820
# Generate constants.
1921
./generate-constants.pl > src/constants.rs

0 commit comments

Comments
 (0)