[rust] replace `*_getc` functions by `*_get`

pull/2173/head
joseLuís 3 years ago
parent 6b22e76b6a
commit ac5b31960c

@ -189,7 +189,7 @@ pub use ffi::{
ncdirect_dim_y,
ncdirect_double_box,
ncdirect_flush,
ncdirect_getc,
ncdirect_get,
ncdirect_init,
ncdirect_inputready_fd,
ncdirect_off_styles,
@ -794,7 +794,7 @@ pub use ffi::{
notcurses_debug,
notcurses_detected_terminal,
notcurses_drop_planes,
notcurses_getc,
notcurses_get,
notcurses_init,
notcurses_inputready_fd,
notcurses_lex_blitter,

@ -571,9 +571,7 @@ impl NcDirect {
} else {
ninput = null_mut();
}
let c = unsafe {
core::char::from_u32_unchecked(crate::ncdirect_getc(self, ntime, null_mut(), ninput))
};
let c = unsafe { core::char::from_u32_unchecked(crate::ncdirect_get(self, ntime, ninput)) };
if c as u32 as i32 == NCRESULT_ERR {
return Err(NcError::new());
}

@ -1,6 +1,6 @@
//! `ncdirect_*` reimplemented functions.
use core::ptr::{null, null_mut};
use core::ptr::null;
use crate::{
cstring, NcCapabilities, NcChannels, NcComponent, NcDim, NcDirect, NcInput, NcIntResult, NcRgb,
@ -68,7 +68,7 @@ pub fn ncdirect_capabilities(ncd: &NcDirect) -> NcCapabilities {
// TODO: use from_u32 & return Option.
#[inline]
pub fn ncdirect_getc_blocking(ncd: &mut NcDirect, input: &mut NcInput) -> char {
unsafe { core::char::from_u32_unchecked(crate::ncdirect_getc(ncd, null(), null_mut(), input)) }
unsafe { core::char::from_u32_unchecked(crate::ncdirect_get(ncd, null(), input)) }
}
///
@ -81,7 +81,7 @@ pub fn ncdirect_getc_blocking(ncd: &mut NcDirect, input: &mut NcInput) -> char {
pub fn ncdirect_getc_nblock(ncd: &mut NcDirect, input: &mut NcInput) -> char {
unsafe {
let ts = NcTime::new();
core::char::from_u32_unchecked(crate::ncdirect_getc(ncd, &ts, null_mut(), input))
core::char::from_u32_unchecked(crate::ncdirect_get(ncd, &ts, input))
}
}

@ -331,9 +331,8 @@ impl Nc {
} else {
ninput = null_mut();
}
let c = unsafe {
core::char::from_u32_unchecked(crate::notcurses_getc(self, ntime, null_mut(), ninput))
};
let c =
unsafe { core::char::from_u32_unchecked(crate::notcurses_get(self, ntime, ninput)) };
if c as u32 as i32 == NCRESULT_ERR {
return Err(NcError::new());
}

@ -44,7 +44,7 @@ pub fn notcurses_getc_nblock(nc: &mut Nc, input: &mut NcInput) -> char {
tv_sec: 0,
tv_nsec: 0,
};
core::char::from_u32_unchecked(crate::notcurses_getc(nc, &ts, null_mut(), input))
core::char::from_u32_unchecked(crate::notcurses_get(nc, &ts, input))
}
}
@ -63,9 +63,7 @@ pub fn notcurses_getc_blocking(nc: &mut Nc, input: Option<&mut NcInput>) -> char
} else {
input_ptr = null_mut();
}
unsafe {
core::char::from_u32_unchecked(crate::notcurses_getc(nc, null(), null_mut(), input_ptr))
}
unsafe { core::char::from_u32_unchecked(crate::notcurses_get(nc, null(), input_ptr)) }
}
/// [notcurses_stdplane()][crate::notcurses_stdplane], plus free bonus

Loading…
Cancel
Save