*: use is_null instead of == ptr::null()

This commit is contained in:
meh
2015-06-08 15:48:28 +02:00
parent ff1b880be6
commit d56ac34413
7 changed files with 23 additions and 25 deletions

View File

@ -74,7 +74,7 @@ impl Context {
pub fn codec(&self) -> Option<Codec> {
unsafe {
if (*self.as_ptr()).codec == ptr::null() {
if (*self.as_ptr()).codec.is_null() {
None
}
else {

View File

@ -16,7 +16,6 @@ pub mod check;
pub use self::check::Check;
use std::ffi::CString;
use std::ptr;
use std::slice::from_raw_parts;
use std::ops::{Deref, DerefMut};
@ -136,7 +135,7 @@ pub fn find(id: Id) -> Option<Codec<'static>> {
unsafe {
let ptr = avcodec_find_decoder(id.into());
if ptr == ptr::null_mut() {
if ptr.is_null() {
None
}
else {
@ -149,7 +148,7 @@ pub fn find_by_name(name: &str) -> Option<Codec<'static>> {
unsafe {
let ptr = avcodec_find_decoder_by_name(CString::new(name).unwrap().as_ptr());
if ptr == ptr::null_mut() {
if ptr.is_null() {
None
}
else {

View File

@ -20,7 +20,6 @@ pub mod decision;
pub use self::decision::Decision;
use std::ffi::CString;
use std::ptr;
use std::ops::{Deref, DerefMut};
use libc::c_int;
@ -126,7 +125,7 @@ pub fn find(id: Id) -> Option<Codec<'static>> {
unsafe {
let ptr = avcodec_find_encoder(id.into());
if ptr == ptr::null_mut() {
if ptr.is_null() {
None
}
else {
@ -139,7 +138,7 @@ pub fn find_by_name(name: &str) -> Option<Codec<'static>> {
unsafe {
let ptr = avcodec_find_encoder_by_name(CString::new(name).unwrap().as_ptr());
if ptr == ptr::null_mut() {
if ptr.is_null() {
None
}
else {