Skip to content

Commit

Permalink
Fix style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
josephlr committed Feb 7, 2019
1 parent b8e350b commit 4642267
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 114 deletions.
30 changes: 20 additions & 10 deletions src/cloudabi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,24 @@ extern {
pub fn isxdigit(c: ::c_int) -> ::c_int;
pub fn tolower(c: ::c_int) -> ::c_int;
pub fn toupper(c: ::c_int) -> ::c_int;
pub fn fopen(filename: *const ::c_char, mode: *const ::c_char) -> *mut FILE;
pub fn fopen(filename: *const ::c_char,
mode: *const ::c_char) -> *mut FILE;
pub fn freopen(filename: *const ::c_char, mode: *const ::c_char,
file: *mut FILE) -> *mut FILE;
pub fn fflush(file: *mut FILE) -> ::c_int;
pub fn fclose(file: *mut FILE) -> ::c_int;
pub fn remove(filename: *const ::c_char) -> ::c_int;
pub fn rename(oldname: *const ::c_char, newname: *const ::c_char) -> ::c_int;
pub fn rename(oldname: *const ::c_char,
newname: *const ::c_char) -> ::c_int;
pub fn tmpfile() -> *mut FILE;
pub fn setvbuf(stream: *mut FILE, buffer: *mut ::c_char, mode: ::c_int,
size: ::size_t) -> ::c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut ::c_char);
pub fn getchar() -> ::c_int;
pub fn putchar(c: ::c_int) -> ::c_int;
pub fn fgetc(stream: *mut FILE) -> ::c_int;
pub fn fgets(buf: *mut ::c_char, n: ::c_int, stream: *mut FILE) -> *mut ::c_char;
pub fn fgets(buf: *mut ::c_char, n: ::c_int,
stream: *mut FILE) -> *mut ::c_char;
pub fn fputc(c: ::c_int, stream: *mut FILE) -> ::c_int;
pub fn fputs(s: *const ::c_char, stream: *mut FILE) -> ::c_int;
pub fn puts(s: *const ::c_char) -> ::c_int;
Expand All @@ -157,7 +160,8 @@ extern {
stream: *mut FILE) -> ::size_t;
pub fn fwrite(ptr: *const ::c_void, size: ::size_t, nobj: ::size_t,
stream: *mut FILE) -> ::size_t;
pub fn fseek(stream: *mut FILE, offset: ::c_long, whence: ::c_int) -> ::c_int;
pub fn fseek(stream: *mut FILE, offset: ::c_long,
whence: ::c_int) -> ::c_int;
pub fn ftell(stream: *mut FILE) -> ::c_long;
pub fn rewind(stream: *mut FILE);
pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> ::c_int;
Expand Down Expand Up @@ -188,9 +192,11 @@ extern {
pub fn strncpy(dst: *mut ::c_char, src: *const ::c_char,
n: ::size_t) -> *mut ::c_char;
pub fn strcat(s: *mut ::c_char, ct: *const ::c_char) -> *mut ::c_char;
pub fn strncat(s: *mut ::c_char, ct: *const ::c_char, n: ::size_t) -> *mut ::c_char;
pub fn strncat(s: *mut ::c_char, ct: *const ::c_char,
n: ::size_t) -> *mut ::c_char;
pub fn strcmp(cs: *const ::c_char, ct: *const ::c_char) -> ::c_int;
pub fn strncmp(cs: *const ::c_char, ct: *const ::c_char, n: ::size_t) -> ::c_int;
pub fn strncmp(cs: *const ::c_char, ct: *const ::c_char,
n: ::size_t) -> ::c_int;
pub fn strcoll(cs: *const ::c_char, ct: *const ::c_char) -> ::c_int;
pub fn strchr(cs: *const ::c_char, c: ::c_int) -> *mut ::c_char;
pub fn strrchr(cs: *const ::c_char, c: ::c_int) -> *mut ::c_char;
Expand All @@ -206,18 +212,22 @@ extern {
pub fn strnlen(cs: *const ::c_char, maxlen: ::size_t) -> ::size_t;
pub fn strerror(n: ::c_int) -> *mut ::c_char;
pub fn strtok(s: *mut ::c_char, t: *const ::c_char) -> *mut ::c_char;
pub fn strxfrm(s: *mut ::c_char, ct: *const ::c_char, n: ::size_t) -> ::size_t;
pub fn strxfrm(s: *mut ::c_char, ct: *const ::c_char,
n: ::size_t) -> ::size_t;
pub fn wcslen(buf: *const wchar_t) -> ::size_t;
pub fn wcstombs(dest: *mut ::c_char, src: *const wchar_t,
n: ::size_t) -> ::size_t;

pub fn memchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
pub fn memcmp(cx: *const ::c_void, ct: *const ::c_void, n: ::size_t) -> ::c_int;
pub fn memchr(cx: *const ::c_void, c: ::c_int,
n: ::size_t) -> *mut ::c_void;
pub fn memcmp(cx: *const ::c_void, ct: *const ::c_void,
n: ::size_t) -> ::c_int;
pub fn memcpy(dest: *mut ::c_void, src: *const ::c_void,
n: ::size_t) -> *mut ::c_void;
pub fn memmove(dest: *mut ::c_void, src: *const ::c_void,
n: ::size_t) -> *mut ::c_void;
pub fn memset(dest: *mut ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
pub fn memset(dest: *mut ::c_void, c: ::c_int,
n: ::size_t) -> *mut ::c_void;

pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
Expand Down
27 changes: 18 additions & 9 deletions src/fuchsia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3080,15 +3080,17 @@ extern {
pub fn fflush(file: *mut FILE) -> ::c_int;
pub fn fclose(file: *mut FILE) -> ::c_int;
pub fn remove(filename: *const ::c_char) -> ::c_int;
pub fn rename(oldname: *const ::c_char, newname: *const ::c_char) -> ::c_int;
pub fn rename(oldname: *const ::c_char,
newname: *const ::c_char) -> ::c_int;
pub fn tmpfile() -> *mut FILE;
pub fn setvbuf(stream: *mut FILE, buffer: *mut ::c_char, mode: ::c_int,
size: ::size_t) -> ::c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut ::c_char);
pub fn getchar() -> ::c_int;
pub fn putchar(c: ::c_int) -> ::c_int;
pub fn fgetc(stream: *mut FILE) -> ::c_int;
pub fn fgets(buf: *mut ::c_char, n: ::c_int, stream: *mut FILE) -> *mut ::c_char;
pub fn fgets(buf: *mut ::c_char, n: ::c_int,
stream: *mut FILE) -> *mut ::c_char;
pub fn fputc(c: ::c_int, stream: *mut FILE) -> ::c_int;
pub fn fputs(s: *const ::c_char, stream: *mut FILE) -> ::c_int;
pub fn puts(s: *const ::c_char) -> ::c_int;
Expand All @@ -3097,7 +3099,8 @@ extern {
stream: *mut FILE) -> ::size_t;
pub fn fwrite(ptr: *const ::c_void, size: ::size_t, nobj: ::size_t,
stream: *mut FILE) -> ::size_t;
pub fn fseek(stream: *mut FILE, offset: ::c_long, whence: ::c_int) -> ::c_int;
pub fn fseek(stream: *mut FILE, offset: ::c_long,
whence: ::c_int) -> ::c_int;
pub fn ftell(stream: *mut FILE) -> ::c_long;
pub fn rewind(stream: *mut FILE);
pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> ::c_int;
Expand Down Expand Up @@ -3129,7 +3132,8 @@ extern {
pub fn strncat(s: *mut ::c_char, ct: *const ::c_char,
n: ::size_t) -> *mut ::c_char;
pub fn strcmp(cs: *const ::c_char, ct: *const ::c_char) -> ::c_int;
pub fn strncmp(cs: *const ::c_char, ct: *const ::c_char, n: ::size_t) -> ::c_int;
pub fn strncmp(cs: *const ::c_char, ct: *const ::c_char,
n: ::size_t) -> ::c_int;
pub fn strcoll(cs: *const ::c_char, ct: *const ::c_char) -> ::c_int;
pub fn strchr(cs: *const ::c_char, c: ::c_int) -> *mut ::c_char;
pub fn strrchr(cs: *const ::c_char, c: ::c_int) -> *mut ::c_char;
Expand All @@ -3142,18 +3146,22 @@ extern {
pub fn strnlen(cs: *const ::c_char, maxlen: ::size_t) -> ::size_t;
pub fn strerror(n: ::c_int) -> *mut ::c_char;
pub fn strtok(s: *mut ::c_char, t: *const ::c_char) -> *mut ::c_char;
pub fn strxfrm(s: *mut ::c_char, ct: *const ::c_char, n: ::size_t) -> ::size_t;
pub fn strxfrm(s: *mut ::c_char, ct: *const ::c_char,
n: ::size_t) -> ::size_t;
pub fn wcslen(buf: *const wchar_t) -> ::size_t;
pub fn wcstombs(dest: *mut ::c_char, src: *const wchar_t,
n: ::size_t) -> ::size_t;

pub fn memchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
pub fn memcmp(cx: *const ::c_void, ct: *const ::c_void, n: ::size_t) -> ::c_int;
pub fn memchr(cx: *const ::c_void, c: ::c_int,
n: ::size_t) -> *mut ::c_void;
pub fn memcmp(cx: *const ::c_void, ct: *const ::c_void,
n: ::size_t) -> ::c_int;
pub fn memcpy(dest: *mut ::c_void, src: *const ::c_void,
n: ::size_t) -> *mut ::c_void;
pub fn memmove(dest: *mut ::c_void, src: *const ::c_void,
n: ::size_t) -> *mut ::c_void;
pub fn memset(dest: *mut ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
pub fn memset(dest: *mut ::c_void, c: ::c_int,
n: ::size_t) -> *mut ::c_void;

pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
Expand Down Expand Up @@ -3786,7 +3794,8 @@ extern {
pub fn flistxattr(filedes: ::c_int, list: *mut ::c_char,
size: ::size_t) -> ::ssize_t;
pub fn removexattr(path: *const ::c_char, name: *const ::c_char) -> ::c_int;
pub fn lremovexattr(path: *const ::c_char, name: *const ::c_char) -> ::c_int;
pub fn lremovexattr(path: *const ::c_char,
name: *const ::c_char) -> ::c_int;
pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char) -> ::c_int;
pub fn signalfd(fd: ::c_int,
mask: *const ::sigset_t,
Expand Down
125 changes: 58 additions & 67 deletions src/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,84 +17,75 @@ pub type size_t = usize;
pub type ptrdiff_t = isize;
pub type ssize_t = isize;

pub const INT_MIN: c_int = -2147483648;
pub const INT_MAX: c_int = 2147483647;

// There are two ways that platforms (in practice) differ in their C types:
// - chars can either be signed or unsigned
// - longs can either be 32-bit or 64-bit

// Whether chars default to signed or unsigned is primarily determined by
// architecture (windows is the main exception here).
pub use self::chars::*;
#[cfg(any(
target_arch = "aarch64",
target_arch = "arm",
target_arch = "armebv7r",
target_arch = "armv5te",
target_arch = "armv7",
target_arch = "armv7r",
target_arch = "armv7s",
target_arch = "asmjs",
target_arch = "wasm32",
target_arch = "wasm64",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "powerpc64le",
target_arch = "s390x",
target_arch = "thumbv6",
target_arch = "thumbv6m",
target_arch = "thummv7",
target_arch = "thumbv7em",
target_arch = "thumbv7m",
target_arch = "thumbv7neon",
target_arch = "tummbv8",
target_arch = "thumbv8m",
target_arch = "thumbv8m.main"
))]
mod chars {
pub type c_char = u8;
pub type wchar_t = u32;
}

#[cfg(any(
target_arch = "i386",
target_arch = "i586",
target_arch = "i686",
target_arch = "x86",
target_arch = "x86_64",
target_arch = "mips",
target_arch = "mips64",
target_arch = "mips64el",
target_arch = "mipsel",
target_arch = "nvptx",
target_arch = "nvptx64",
target_arch = "sparc64",
target_arch = "sparcv9",
target_arch = "riscv64",
target_arch = "riscv32",
target_arch = "riscv32imac",
target_arch = "riscv32imc"
))]
mod chars {
pub type c_char = i8;
pub type wchar_t = i32;
cfg_if! {
if #[cfg(any(target_arch = "aarch64",
target_arch = "arm",
target_arch = "armebv7r",
target_arch = "armv5te",
target_arch = "armv7",
target_arch = "armv7r",
target_arch = "armv7s",
target_arch = "asmjs",
target_arch = "wasm32",
target_arch = "wasm64",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "powerpc64le",
target_arch = "s390x",
target_arch = "thumbv6",
target_arch = "thumbv6m",
target_arch = "thummv7",
target_arch = "thumbv7em",
target_arch = "thumbv7m",
target_arch = "thumbv7neon",
target_arch = "tummbv8",
target_arch = "thumbv8m",
target_arch = "thumbv8m.main"))] {
pub type c_char = u8;
pub type wchar_t = u32;
} else if #[cfg(any(target_arch = "i386",
target_arch = "i586",
target_arch = "i686",
target_arch = "x86",
target_arch = "x86_64",
target_arch = "mips",
target_arch = "mips64",
target_arch = "mips64el",
target_arch = "mipsel",
target_arch = "nvptx",
target_arch = "nvptx64",
target_arch = "sparc64",
target_arch = "sparcv9",
target_arch = "riscv64",
target_arch = "riscv32",
target_arch = "riscv32imac",
target_arch = "riscv32imc"))] {
pub type c_char = i8;
pub type wchar_t = i32;
}
}

// On all platforms but Windows, longs are the same size as a pointer.
pub use self::long::*;
#[cfg(target_pointer_width = "64")]
mod long {
pub type c_long = i64;
pub type c_ulong = u64;
}

#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))]
mod long {
pub type c_long = i32;
pub type c_ulong = u32;
cfg_if! {
if #[cfg(target_pointer_width = "64")] {
pub type c_long = i64;
pub type c_ulong = u64;
} else {
pub type c_long = i32;
pub type c_ulong = u32;
}
}

// POSIX specifications make no guarantees that off_t == long int, but this is
// what GNU and others always do.
pub type off_t = ::c_long;

// These follow directly from the definition of c_int
pub const INT_MIN: c_int = -2147483648;
pub const INT_MAX: c_int = 2147483647;
28 changes: 18 additions & 10 deletions src/redox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,17 @@ extern {
pub fn fflush(file: *mut FILE) -> ::c_int;
pub fn fclose(file: *mut FILE) -> ::c_int;
pub fn remove(filename: *const ::c_char) -> ::c_int;
pub fn rename(oldname: *const ::c_char, newname: *const ::c_char) -> ::c_int;
pub fn rename(oldname: *const ::c_char,
newname: *const ::c_char) -> ::c_int;
pub fn tmpfile() -> *mut FILE;
pub fn setvbuf(stream: *mut FILE, buffer: *mut ::c_char, mode: ::c_int,
size: ::size_t) -> ::c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut ::c_char);
pub fn getchar() -> ::c_int;
pub fn putchar(c: ::c_int) -> ::c_int;
pub fn fgetc(stream: *mut FILE) -> ::c_int;
pub fn fgets(buf: *mut ::c_char, n: ::c_int, stream: *mut FILE) -> *mut ::c_char;
pub fn fgets(buf: *mut ::c_char, n: ::c_int,
stream: *mut FILE) -> *mut ::c_char;
pub fn fputc(c: ::c_int, stream: *mut FILE) -> ::c_int;
pub fn fputs(s: *const ::c_char, stream: *mut FILE) -> ::c_int;
pub fn puts(s: *const ::c_char) -> ::c_int;
Expand All @@ -265,7 +267,8 @@ extern {
stream: *mut FILE) -> ::size_t;
pub fn fwrite(ptr: *const ::c_void, size: ::size_t, nobj: ::size_t,
stream: *mut FILE) -> ::size_t;
pub fn fseek(stream: *mut FILE, offset: ::c_long, whence: ::c_int) -> ::c_int;
pub fn fseek(stream: *mut FILE, offset: ::c_long,
whence: ::c_int) -> ::c_int;
pub fn ftell(stream: *mut FILE) -> ::c_long;
pub fn rewind(stream: *mut FILE);
pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> ::c_int;
Expand Down Expand Up @@ -307,26 +310,31 @@ extern {
pub fn strdup(cs: *const ::c_char) -> *mut ::c_char;
pub fn strpbrk(cs: *const ::c_char, ct: *const ::c_char) -> *mut ::c_char;
pub fn strstr(cs: *const ::c_char, ct: *const ::c_char) -> *mut ::c_char;
pub fn strcasestr(cs: *const ::c_char, ct: *const ::c_char) -> *mut ::c_char;
pub fn strcasestr(cs: *const ::c_char,
ct: *const ::c_char) -> *mut ::c_char;
pub fn strcasecmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
pub fn strncasecmp(s1: *const ::c_char, s2: *const ::c_char,
n: ::size_t) -> ::c_int;
pub fn strlen(cs: *const ::c_char) -> ::size_t;
pub fn strnlen(cs: *const ::c_char, maxlen: ::size_t) -> ::size_t;
pub fn strerror(n: ::c_int) -> *mut ::c_char;
pub fn strtok(s: *mut ::c_char, t: *const ::c_char) -> *mut ::c_char;
pub fn strxfrm(s: *mut ::c_char, ct: *const ::c_char, n: ::size_t) -> ::size_t;
pub fn strxfrm(s: *mut ::c_char, ct: *const ::c_char,
n: ::size_t) -> ::size_t;
pub fn wcslen(buf: *const wchar_t) -> ::size_t;
pub fn wcstombs(dest: *mut ::c_char, src: *const wchar_t,
n: ::size_t) -> ::size_t;

pub fn memchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
pub fn memcmp(cx: *const ::c_void, ct: *const ::c_void, n: ::size_t) -> ::c_int;
pub fn memchr(cx: *const ::c_void, c: ::c_int,
n: ::size_t) -> *mut ::c_void;
pub fn memcmp(cx: *const ::c_void, ct: *const ::c_void,
n: ::size_t) -> ::c_int;
pub fn memcpy(dest: *mut ::c_void, src: *const ::c_void,
n: ::size_t) -> *mut ::c_void;
pub fn memmove(dest: *mut ::c_void, src: *const ::c_void,
n: ::size_t) -> *mut ::c_void;
pub fn memset(dest: *mut ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
pub fn memset(dest: *mut ::c_void, c: ::c_int,
n: ::size_t) -> *mut ::c_void;

pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
Expand Down Expand Up @@ -355,8 +363,8 @@ extern {
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t;
pub fn setenv(name: *const ::c_char, val: *const ::c_char, overwrite: ::c_int)
-> ::c_int;
pub fn setenv(name: *const ::c_char, val: *const ::c_char,
overwrite: ::c_int) -> ::c_int;
pub fn unsetenv(name: *const ::c_char) -> ::c_int;
pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
-> ::ssize_t;
Expand Down
Loading

0 comments on commit 4642267

Please sign in to comment.