From 69e89a194ea0b9db6b6d54a70dae7d70ce4bc32d Mon Sep 17 00:00:00 2001
From: sateffen <sateffen@gmail.com>
Date: Mon, 11 Jul 2016 08:36:52 +0000
Subject: [PATCH] Refactored linger struct dry

---
 src/unix/bsd/apple/mod.rs               | 5 -----
 src/unix/bsd/freebsdlike/mod.rs         | 5 -----
 src/unix/bsd/openbsdlike/mod.rs         | 5 -----
 src/unix/mod.rs                         | 5 +++++
 src/unix/notbsd/android/mod.rs          | 5 -----
 src/unix/notbsd/linux/mips.rs           | 5 -----
 src/unix/notbsd/linux/musl/b32/arm.rs   | 5 -----
 src/unix/notbsd/linux/musl/b32/asmjs.rs | 5 -----
 src/unix/notbsd/linux/musl/b32/mips.rs  | 5 -----
 src/unix/notbsd/linux/musl/b32/x86.rs   | 5 -----
 src/unix/notbsd/linux/musl/b64/mod.rs   | 5 -----
 src/unix/notbsd/linux/other/mod.rs      | 5 -----
 src/unix/solaris/mod.rs                 | 5 -----
 13 files changed, 5 insertions(+), 60 deletions(-)

diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 7851ad19..f4235fdc 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -287,11 +287,6 @@ s! {
         pub int_p_sign_posn: ::c_char,
         pub int_n_sign_posn: ::c_char,
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index ef860d84..e7e04a78 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -155,11 +155,6 @@ s! {
     pub struct _sem {
         data: [u32; 4],
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs
index c2f8d85f..53e7c3c2 100644
--- a/src/unix/bsd/openbsdlike/mod.rs
+++ b/src/unix/bsd/openbsdlike/mod.rs
@@ -54,11 +54,6 @@ s! {
         pub l_type: ::c_short,
         pub l_whence: ::c_short,
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const D_T_FMT: ::nl_item = 0;
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index d799ec13..214f2cc0 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -109,6 +109,11 @@ s! {
         pub ws_xpixel: ::c_ushort,
         pub ws_ypixel: ::c_ushort,
     }
+
+    pub struct linger {
+        pub l_onoff: ::c_int,
+        pub l_linger: ::c_int,
+    }
 }
 
 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs
index a96d2789..6ddcfafc 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -99,11 +99,6 @@ s! {
     pub struct sem_t {
         count: ::c_uint,
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const BUFSIZ: ::c_uint = 1024;
diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs
index a9611b2b..fa5a2a36 100644
--- a/src/unix/notbsd/linux/mips.rs
+++ b/src/unix/notbsd/linux/mips.rs
@@ -198,11 +198,6 @@ s! {
         __size: [::c_char; 32],
         __align: [::c_long; 0],
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const BUFSIZ: ::c_uint = 8192;
diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs
index a9dfe12d..5d648618 100644
--- a/src/unix/notbsd/linux/musl/b32/arm.rs
+++ b/src/unix/notbsd/linux/musl/b32/arm.rs
@@ -82,11 +82,6 @@ s! {
         pub f_flags: ::c_ulong,
         pub f_spare: [::c_ulong; 4],
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const O_DIRECT: ::c_int = 0x4000;
diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs
index f813150e..93e4ab6b 100644
--- a/src/unix/notbsd/linux/musl/b32/asmjs.rs
+++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs
@@ -82,11 +82,6 @@ s! {
         pub f_flags: ::c_ulong,
         pub f_spare: [::c_ulong; 4],
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const O_DIRECT: ::c_int = 0x4000;
diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs
index f59458ea..f52d1953 100644
--- a/src/unix/notbsd/linux/musl/b32/mips.rs
+++ b/src/unix/notbsd/linux/musl/b32/mips.rs
@@ -81,11 +81,6 @@ s! {
         pub f_flags: ::c_ulong,
         pub f_spare: [::c_ulong; 5],
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const O_DIRECT: ::c_int = 0o100000;
diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs
index e849efee..9d057de7 100644
--- a/src/unix/notbsd/linux/musl/b32/x86.rs
+++ b/src/unix/notbsd/linux/musl/b32/x86.rs
@@ -95,11 +95,6 @@ s! {
         pub uc_sigmask: ::sigset_t,
         __private: [u8; 112],
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const O_DIRECT: ::c_int = 0x4000;
diff --git a/src/unix/notbsd/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs
index 8f48e0f4..0501c553 100644
--- a/src/unix/notbsd/linux/musl/b64/mod.rs
+++ b/src/unix/notbsd/linux/musl/b64/mod.rs
@@ -104,11 +104,6 @@ s! {
     pub struct sem_t {
         __val: [::c_int; 8],
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs
index deda1a48..2998fbc2 100644
--- a/src/unix/notbsd/linux/other/mod.rs
+++ b/src/unix/notbsd/linux/other/mod.rs
@@ -130,11 +130,6 @@ s! {
         __size: [::c_char; 32],
         __align: [::c_long; 0],
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const RLIMIT_RSS: ::c_int = 5;
diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs
index 0ef2e81d..56cb76ea 100644
--- a/src/unix/solaris/mod.rs
+++ b/src/unix/solaris/mod.rs
@@ -318,11 +318,6 @@ s! {
         pub l_pid: ::pid_t,
         pub l_pad: [::c_long; 4]
     }
-
-    pub struct linger {
-        pub l_onoff: ::c_int,
-        pub l_linger: ::c_int,
-    }
 }
 
 pub const LC_CTYPE: ::c_int = 0;
-- 
GitLab