diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-04-30 16:37:26 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-04-30 16:37:26 -0700 |
| commit | 4288a08e9a640e2b24d2f5974f6785f0ab82694b (patch) | |
| tree | 0d57a251be748b1d508f361e3dffc1f25daef046 | |
| parent | e962870420fef19e8f23a299dbe7499aca1656a5 (diff) | |
| download | rust-4288a08e9a640e2b24d2f5974f6785f0ab82694b.tar.gz rust-4288a08e9a640e2b24d2f5974f6785f0ab82694b.zip | |
std: Favor cfg! over #[cfg] in unix rwlocks
| -rw-r--r-- | src/libstd/sys/unix/rwlock.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/libstd/sys/unix/rwlock.rs b/src/libstd/sys/unix/rwlock.rs index adf9da2d067..b754d3a97cf 100644 --- a/src/libstd/sys/unix/rwlock.rs +++ b/src/libstd/sys/unix/rwlock.rs @@ -49,21 +49,16 @@ impl RWLock { #[inline] pub unsafe fn write_unlock(&self) { self.read_unlock() } #[inline] - #[cfg(not(target_os = "dragonfly"))] pub unsafe fn destroy(&self) { let r = ffi::pthread_rwlock_destroy(self.inner.get()); - debug_assert_eq!(r, 0); - } - - #[inline] - #[cfg(target_os = "dragonfly")] - pub unsafe fn destroy(&self) { - use libc; - let r = ffi::pthread_rwlock_destroy(self.inner.get()); // On DragonFly pthread_rwlock_destroy() returns EINVAL if called on a // rwlock that was just initialized with // ffi::PTHREAD_RWLOCK_INITIALIZER. Once it is used (locked/unlocked) // or pthread_rwlock_init() is called, this behaviour no longer occurs. - debug_assert!(r == 0 || r == libc::EINVAL); + if cfg!(target_os = "dragonfly") { + debug_assert!(r == 0 || r == libc::EINVAL); + } else { + debug_assert_eq!(r, 0); + } } } |
