Use core::ffi::VaList

parent fc9e3923
Pipeline #2092 passed with stages
in 20 minutes and 27 seconds
......@@ -239,7 +239,6 @@ dependencies = [
"redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"sc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"va_list 0.1.0",
]
[[package]]
......@@ -411,20 +410,6 @@ name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "va_list"
version = "0.1.0"
dependencies = [
"va_list-helper 0.0.2",
]
[[package]]
name = "va_list-helper"
version = "0.0.2"
dependencies = [
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "vec_map"
version = "0.8.1"
......
......@@ -20,7 +20,6 @@ core_io = { path = "core_io", features = ["collections"] }
lazy_static = { version = "1.2.0", features = ["nightly", "spin_no_std"] }
posix-regex = { path = "posix-regex", features = ["no_std"] }
rand = { version = "0.5.5", default-features = false }
va_list = { path = "va_list", features = ["no_std"] }
[dependencies.compiler_builtins]
git = "https://github.com/rust-lang-nursery/compiler-builtins.git"
......
#!/bin/bash
set -ex
./fmt.sh -- --write-mode=diff
./fmt.sh -- --check
if [ -z "$TARGET" ]
then
make all
......
nightly-2018-11-07
nightly-2018-12-04
......@@ -6,7 +6,7 @@ use alloc::vec::Vec;
use core::{fmt, mem, ptr, slice, str};
use core::fmt::Write as WriteFmt;
use core::ops::{Deref, DerefMut};
use va_list::VaList as va_list;
use core::ffi::VaList as va_list;
use c_str::CStr;
use fs::File;
......
This diff is collapsed.
......@@ -2,7 +2,7 @@ use alloc::string::String;
use alloc::vec::Vec;
use io::Read;
use platform::types::*;
use va_list::VaList;
use core::ffi::VaList as va_list;
#[derive(PartialEq, Eq)]
enum IntKind {
......@@ -30,7 +30,7 @@ unsafe fn next_byte(string: &mut *const c_char) -> Result<u8, c_int> {
unsafe fn inner_scanf<R: Read>(
mut r: R,
mut format: *const c_char,
mut ap: VaList,
mut ap: va_list,
) -> Result<c_int, c_int> {
let mut matched = 0;
let mut byte = 0;
......@@ -228,7 +228,7 @@ unsafe fn inner_scanf<R: Read>(
n.parse::<$type>().map_err(|_| 0)?
};
if !ignore {
*ap.get::<*mut $type>() = n;
*ap.arg::<*mut $type>() = n;
matched += 1;
}
}};
......@@ -248,7 +248,7 @@ unsafe fn inner_scanf<R: Read>(
$type::from_str_radix(&n, radix).map_err(|_| 0)?
};
if !ignore {
*ap.get::<*mut $final>() = n as $final;
*ap.arg::<*mut $final>() = n as $final;
matched += 1;
}
}};
......@@ -326,7 +326,7 @@ unsafe fn inner_scanf<R: Read>(
}
}
let mut ptr: Option<*mut c_char> = if ignore { None } else { Some(ap.get()) };
let mut ptr: Option<*mut c_char> = if ignore { None } else { Some(ap.arg()) };
while width.map(|w| w > 0).unwrap_or(true) && !(byte as char).is_whitespace() {
if let Some(ref mut ptr) = ptr {
......@@ -345,7 +345,7 @@ unsafe fn inner_scanf<R: Read>(
}
}
b'c' => {
let mut ptr: Option<*mut c_char> = if ignore { None } else { Some(ap.get()) };
let mut ptr: Option<*mut c_char> = if ignore { None } else { Some(ap.arg()) };
for i in 0..width.unwrap_or(1) {
if let Some(ptr) = ptr {
......@@ -395,7 +395,7 @@ unsafe fn inner_scanf<R: Read>(
}
}
let mut ptr: Option<*mut c_char> = if ignore { None } else { Some(ap.get()) };
let mut ptr: Option<*mut c_char> = if ignore { None } else { Some(ap.arg()) };
while width.map(|w| w > 0).unwrap_or(true) && !invert == matches.contains(&byte)
{
......@@ -416,7 +416,7 @@ unsafe fn inner_scanf<R: Read>(
}
b'n' => {
if !ignore {
*ap.get::<*mut c_int>() = count as c_int;
*ap.arg::<*mut c_int>() = count as c_int;
}
}
_ => return Err(-1),
......@@ -431,7 +431,7 @@ unsafe fn inner_scanf<R: Read>(
}
Ok(matched)
}
pub unsafe fn scanf<R: Read>(r: R, format: *const c_char, ap: VaList) -> c_int {
pub unsafe fn scanf<R: Read>(r: R, format: *const c_char, ap: va_list) -> c_int {
match inner_scanf(r, format, ap) {
Ok(n) => n,
Err(n) => n,
......
//! wchar implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/wchar.h.html
use core::ffi::VaList as va_list;
use core::ptr;
use va_list::VaList as va_list;
use header::stdio::*;
use header::stdlib::MB_CUR_MAX;
......
......@@ -4,6 +4,7 @@
#![allow(unused_variables)]
#![feature(alloc)]
#![feature(allocator_api)]
#![feature(c_variadic)]
#![feature(const_fn)]
#![feature(const_vec_new)]
#![feature(core_intrinsics)]
......@@ -28,7 +29,6 @@ extern crate core_io;
extern crate lazy_static;
extern crate posix_regex;
extern crate rand;
extern crate va_list;
#[cfg(target_os = "linux")]
#[macro_use]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment