mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
chore: use ptr::{null, null_mut} instead of 0 as *{const, mut} (#1333)
This commit is contained in:
@@ -16,6 +16,7 @@ use tokio_executor;
|
|||||||
use log::trace;
|
use log::trace;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
use std::ptr;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::atomic::Ordering::{AcqRel, Acquire};
|
use std::sync::atomic::Ordering::{AcqRel, Acquire};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@@ -81,7 +82,7 @@ struct CurrentTask {
|
|||||||
pub struct WorkerId(pub(crate) usize);
|
pub struct WorkerId(pub(crate) usize);
|
||||||
|
|
||||||
// Pointer to the current worker info
|
// Pointer to the current worker info
|
||||||
thread_local!(static CURRENT_WORKER: Cell<*const Worker> = Cell::new(0 as *const _));
|
thread_local!(static CURRENT_WORKER: Cell<*const Worker> = Cell::new(ptr::null()));
|
||||||
|
|
||||||
impl Worker {
|
impl Worker {
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use native_tls::{Identity, TlsAcceptor, TlsConnector};
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::marker::Unpin;
|
use std::marker::Unpin;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use std::ptr;
|
||||||
use tokio::io::{AsyncReadExt, AsyncWrite, AsyncWriteExt, Error, ErrorKind};
|
use tokio::io::{AsyncReadExt, AsyncWrite, AsyncWriteExt, Error, ErrorKind};
|
||||||
use tokio::net::{TcpListener, TcpStream};
|
use tokio::net::{TcpListener, TcpStream};
|
||||||
use tokio_tls;
|
use tokio_tls;
|
||||||
@@ -33,7 +34,7 @@ struct Keys {
|
|||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn openssl_keys() -> &'static Keys {
|
fn openssl_keys() -> &'static Keys {
|
||||||
static INIT: Once = Once::new();
|
static INIT: Once = Once::new();
|
||||||
static mut KEYS: *mut Keys = 0 as *mut _;
|
static mut KEYS: *mut Keys = ptr::null_mut();
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
let path = t!(env::current_exe());
|
let path = t!(env::current_exe());
|
||||||
@@ -160,7 +161,7 @@ cfg_if! {
|
|||||||
// self-signed certificate, so we just fork out to the `openssl` binary.
|
// self-signed certificate, so we just fork out to the `openssl` binary.
|
||||||
fn keys() -> (&'static [u8], &'static [u8]) {
|
fn keys() -> (&'static [u8], &'static [u8]) {
|
||||||
static INIT: Once = Once::new();
|
static INIT: Once = Once::new();
|
||||||
static mut KEYS: *mut (Vec<u8>, Vec<u8>) = 0 as *mut _;
|
static mut KEYS: *mut (Vec<u8>, Vec<u8>) = ptr::null_mut();
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
let (key, cert) = openssl_keys();
|
let (key, cert) = openssl_keys();
|
||||||
@@ -266,7 +267,6 @@ cfg_if! {
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Error;
|
use std::io::Error;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
|
|
||||||
use schannel::cert_context::CertContext;
|
use schannel::cert_context::CertContext;
|
||||||
|
|||||||
Reference in New Issue
Block a user