Merge branch 'ptr-offset-by-literal-lint' into 'master'
add ptr_offset_by_literal clippy lint and set to deny See merge request redox-os/relibc!1527
This commit is contained in:
@@ -36,6 +36,7 @@ mut_from_ref = "deny"
|
|||||||
precedence = "deny"
|
precedence = "deny"
|
||||||
ptr_as_ptr = "warn" # TODO review occurrences
|
ptr_as_ptr = "warn" # TODO review occurrences
|
||||||
ptr_cast_constness = "warn" # TODO review occurrences
|
ptr_cast_constness = "warn" # TODO review occurrences
|
||||||
|
ptr_offset_by_literal = "deny"
|
||||||
ref_as_ptr = "warn" # TODO review occurrences
|
ref_as_ptr = "warn" # TODO review occurrences
|
||||||
upper_case_acronyms = "allow" # TODO review occurrences
|
upper_case_acronyms = "allow" # TODO review occurrences
|
||||||
zero_ptr = "deny" # must allow on public constants due to cbindgen issue
|
zero_ptr = "deny" # must allow on public constants due to cbindgen issue
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ unsafe fn tokenize(mut pattern: *const u8, flags: c_int) -> Tree {
|
|||||||
leading = false;
|
leading = false;
|
||||||
|
|
||||||
let c = unsafe { *pattern };
|
let c = unsafe { *pattern };
|
||||||
pattern = unsafe { pattern.offset(1) };
|
pattern = unsafe { pattern.add(1) };
|
||||||
|
|
||||||
match (c == b'*', need_collapsing) {
|
match (c == b'*', need_collapsing) {
|
||||||
(true, true) => continue,
|
(true, true) => continue,
|
||||||
@@ -76,7 +76,7 @@ unsafe fn tokenize(mut pattern: *const u8, flags: c_int) -> Tree {
|
|||||||
// Trailing backslash. Maybe error here?
|
// Trailing backslash. Maybe error here?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pattern = unsafe { pattern.offset(1) };
|
pattern = unsafe { pattern.add(1) };
|
||||||
leading = is_leading(flags, c);
|
leading = is_leading(flags, c);
|
||||||
(Token::Char(c), ONCE)
|
(Token::Char(c), ONCE)
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ unsafe fn tokenize(mut pattern: *const u8, flags: c_int) -> Tree {
|
|||||||
b'[' => {
|
b'[' => {
|
||||||
let mut list: Vec<Collation> = Vec::new();
|
let mut list: Vec<Collation> = Vec::new();
|
||||||
let invert = if unsafe { *pattern == b'!' } {
|
let invert = if unsafe { *pattern == b'!' } {
|
||||||
pattern = unsafe { pattern.offset(1) };
|
pattern = unsafe { pattern.add(1) };
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
@@ -96,12 +96,12 @@ unsafe fn tokenize(mut pattern: *const u8, flags: c_int) -> Tree {
|
|||||||
if c == 0 {
|
if c == 0 {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pattern = unsafe { pattern.offset(1) };
|
pattern = unsafe { pattern.add(1) };
|
||||||
match c {
|
match c {
|
||||||
b']' => break,
|
b']' => break,
|
||||||
b'\\' => {
|
b'\\' => {
|
||||||
c = unsafe { *pattern };
|
c = unsafe { *pattern };
|
||||||
pattern = unsafe { pattern.offset(1) };
|
pattern = unsafe { pattern.add(1) };
|
||||||
if c == 0 {
|
if c == 0 {
|
||||||
// Trailing backslash. Maybe error?
|
// Trailing backslash. Maybe error?
|
||||||
break;
|
break;
|
||||||
@@ -109,9 +109,9 @@ unsafe fn tokenize(mut pattern: *const u8, flags: c_int) -> Tree {
|
|||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
if unsafe { *pattern == b'-' && *pattern.offset(1) != 0 } {
|
if unsafe { *pattern == b'-' && *pattern.add(1) != 0 } {
|
||||||
let end = unsafe { *pattern.offset(1) };
|
let end = unsafe { *pattern.add(1) };
|
||||||
pattern = unsafe { pattern.offset(2) };
|
pattern = unsafe { pattern.add(2) };
|
||||||
for c in c..=end {
|
for c in c..=end {
|
||||||
if can_push(was_leading, flags, c) {
|
if can_push(was_leading, flags, c) {
|
||||||
list.push(Collation::Char(c));
|
list.push(Collation::Char(c));
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ pub unsafe extern "C" fn getopt_long(
|
|||||||
if unsafe {
|
if unsafe {
|
||||||
current_arg.is_null()
|
current_arg.is_null()
|
||||||
|| *current_arg != ByteLiteral::cast_cchar(b'-')
|
|| *current_arg != ByteLiteral::cast_cchar(b'-')
|
||||||
|| *current_arg.offset(1) == 0
|
|| *current_arg.add(1) == 0
|
||||||
} {
|
} {
|
||||||
-1
|
-1
|
||||||
} else if unsafe { string::strcmp(current_arg, c"--".as_ptr()) == 0 } {
|
} else if unsafe { string::strcmp(current_arg, c"--".as_ptr()) == 0 } {
|
||||||
@@ -73,10 +73,10 @@ pub unsafe extern "C" fn getopt_long(
|
|||||||
-1
|
-1
|
||||||
} else {
|
} else {
|
||||||
// remove the '-'
|
// remove the '-'
|
||||||
let current_arg = unsafe { current_arg.offset(1) };
|
let current_arg = unsafe { current_arg.add(1) };
|
||||||
|
|
||||||
if unsafe { *current_arg == ByteLiteral::cast_cchar(b'-') } && !longopts.is_null() {
|
if unsafe { *current_arg == ByteLiteral::cast_cchar(b'-') } && !longopts.is_null() {
|
||||||
let current_arg = unsafe { current_arg.offset(1) };
|
let current_arg = unsafe { current_arg.add(1) };
|
||||||
// is a long option
|
// is a long option
|
||||||
for i in 0.. {
|
for i in 0.. {
|
||||||
let opt = unsafe { &*longopts.offset(i) };
|
let opt = unsafe { &*longopts.offset(i) };
|
||||||
@@ -156,7 +156,7 @@ unsafe fn parse_arg(
|
|||||||
optstring: *const c_char,
|
optstring: *const c_char,
|
||||||
) -> c_int {
|
) -> c_int {
|
||||||
let update_current_opt = || unsafe {
|
let update_current_opt = || unsafe {
|
||||||
CURRENT_OPT = current_arg.offset(1);
|
CURRENT_OPT = current_arg.add(1);
|
||||||
if *CURRENT_OPT == 0 {
|
if *CURRENT_OPT == 0 {
|
||||||
optind += 1;
|
optind += 1;
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ unsafe fn parse_arg(
|
|||||||
}
|
}
|
||||||
Some(GetoptOption::OptArg) => unsafe {
|
Some(GetoptOption::OptArg) => unsafe {
|
||||||
CURRENT_OPT = c"".as_ptr().cast_mut();
|
CURRENT_OPT = c"".as_ptr().cast_mut();
|
||||||
if *current_arg.offset(1) == 0 {
|
if *current_arg.add(1) == 0 {
|
||||||
optind += 2;
|
optind += 2;
|
||||||
if optind > argc {
|
if optind > argc {
|
||||||
CURRENT_OPT = ptr::null_mut();
|
CURRENT_OPT = ptr::null_mut();
|
||||||
@@ -200,7 +200,7 @@ unsafe fn parse_arg(
|
|||||||
c_int::from(*current_arg)
|
c_int::from(*current_arg)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
optarg = current_arg.offset(1);
|
optarg = current_arg.add(1);
|
||||||
optind += 1;
|
optind += 1;
|
||||||
|
|
||||||
c_int::from(*current_arg)
|
c_int::from(*current_arg)
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ pub unsafe extern "C" fn gethostbyaddr(
|
|||||||
unsafe { sethostent(HOST_STAYOPEN) };
|
unsafe { sethostent(HOST_STAYOPEN) };
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
cp = unsafe { cp.offset(1) };
|
cp = unsafe { cp.add(1) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ pub unsafe extern "C" fn gethostbyname(name: *const c_char) -> *mut hostent {
|
|||||||
unsafe { sethostent(HOST_STAYOPEN) };
|
unsafe { sethostent(HOST_STAYOPEN) };
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
cp = unsafe { cp.offset(1) };
|
cp = unsafe { cp.add(1) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,7 +542,7 @@ pub unsafe extern "C" fn getprotobyname(name: *const c_char) -> *mut protoent {
|
|||||||
unsafe { setprotoent(PROTO_STAYOPEN) };
|
unsafe { setprotoent(PROTO_STAYOPEN) };
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
cp = unsafe { cp.offset(1) };
|
cp = unsafe { cp.add(1) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsafe { setprotoent(PROTO_STAYOPEN) };
|
unsafe { setprotoent(PROTO_STAYOPEN) };
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ pub unsafe extern "C" fn fgets(
|
|||||||
let unget_read_size = cmp::min(left, stream.unget.len());
|
let unget_read_size = cmp::min(left, stream.unget.len());
|
||||||
for _ in 0..unget_read_size {
|
for _ in 0..unget_read_size {
|
||||||
unsafe { *out = stream.unget.pop().unwrap() as c_char };
|
unsafe { *out = stream.unget.pop().unwrap() as c_char };
|
||||||
out = unsafe { out.offset(1) };
|
out = unsafe { out.add(1) };
|
||||||
}
|
}
|
||||||
left -= unget_read_size;
|
left -= unget_read_size;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ pub unsafe fn inner_scanf<T: Kind>(
|
|||||||
{
|
{
|
||||||
if let Some(ref mut ptr) = ptr {
|
if let Some(ref mut ptr) = ptr {
|
||||||
unsafe { **ptr = character as c_char };
|
unsafe { **ptr = character as c_char };
|
||||||
*ptr = unsafe { ptr.offset(1) };
|
*ptr = unsafe { ptr.add(1) };
|
||||||
data_stored = true;
|
data_stored = true;
|
||||||
}
|
}
|
||||||
// Decrease the width, and read a new character unless the width is 0
|
// Decrease the width, and read a new character unless the width is 0
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ pub unsafe extern "C" fn exit(status: c_int) -> ! {
|
|||||||
let mut f = core::ptr::from_ref(unsafe { &__fini_array_end });
|
let mut f = core::ptr::from_ref(unsafe { &__fini_array_end });
|
||||||
#[allow(clippy::op_ref)]
|
#[allow(clippy::op_ref)]
|
||||||
while f > &raw const __fini_array_start {
|
while f > &raw const __fini_array_start {
|
||||||
f = unsafe { f.offset(-1) };
|
f = unsafe { f.sub(1) };
|
||||||
(unsafe { *f })();
|
(unsafe { *f })();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,7 +538,7 @@ pub unsafe extern "C" fn initstate(seed: c_uint, state: *mut c_char, size: size_
|
|||||||
_ => 63,
|
_ => 63,
|
||||||
};
|
};
|
||||||
|
|
||||||
random_state.x_ptr = unsafe { (state.cast::<[u8; 4]>()).offset(1) };
|
random_state.x_ptr = unsafe { (state.cast::<[u8; 4]>()).add(1) };
|
||||||
unsafe { random_state.seed(seed) };
|
unsafe { random_state.seed(seed) };
|
||||||
unsafe { random_state.save() };
|
unsafe { random_state.save() };
|
||||||
|
|
||||||
@@ -1378,7 +1378,7 @@ pub unsafe fn detect_base(s: *const c_char) -> Option<(c_int, isize)> {
|
|||||||
match first {
|
match first {
|
||||||
0 => None,
|
0 => None,
|
||||||
b'0' => {
|
b'0' => {
|
||||||
let second = unsafe { *s.offset(1) } as u8;
|
let second = unsafe { *s.add(1) } as u8;
|
||||||
if second == b'X' || second == b'x' {
|
if second == b'X' || second == b'x' {
|
||||||
Some((16, 2))
|
Some((16, 2))
|
||||||
} else if (b'0'..=b'7').contains(&second) {
|
} else if (b'0'..=b'7').contains(&second) {
|
||||||
@@ -1394,7 +1394,7 @@ pub unsafe fn detect_base(s: *const c_char) -> Option<(c_int, isize)> {
|
|||||||
|
|
||||||
pub unsafe fn convert_octal(s: *const c_char) -> Option<(c_ulong, isize, bool)> {
|
pub unsafe fn convert_octal(s: *const c_char) -> Option<(c_ulong, isize, bool)> {
|
||||||
if unsafe { *s } != 0 && unsafe { *s } == ByteLiteral::cast_cchar(b'0') {
|
if unsafe { *s } != 0 && unsafe { *s } == ByteLiteral::cast_cchar(b'0') {
|
||||||
if let Some((val, idx, overflow)) = unsafe { convert_integer(s.offset(1), 8) } {
|
if let Some((val, idx, overflow)) = unsafe { convert_integer(s.add(1), 8) } {
|
||||||
Some((val, idx + 1, overflow))
|
Some((val, idx + 1, overflow))
|
||||||
} else {
|
} else {
|
||||||
// in case the prefix is not actually a prefix
|
// in case the prefix is not actually a prefix
|
||||||
@@ -1407,11 +1407,11 @@ pub unsafe fn convert_octal(s: *const c_char) -> Option<(c_ulong, isize, bool)>
|
|||||||
|
|
||||||
pub unsafe fn convert_hex(s: *const c_char) -> Option<(c_ulong, isize, bool)> {
|
pub unsafe fn convert_hex(s: *const c_char) -> Option<(c_ulong, isize, bool)> {
|
||||||
if (unsafe { *s } != 0 && unsafe { *s } == ByteLiteral::cast_cchar(b'0'))
|
if (unsafe { *s } != 0 && unsafe { *s } == ByteLiteral::cast_cchar(b'0'))
|
||||||
&& (unsafe { *s.offset(1) } != 0
|
&& (unsafe { *s.add(1) } != 0
|
||||||
&& (unsafe { *s.offset(1) } == ByteLiteral::cast_cchar(b'x')
|
&& (unsafe { *s.add(1) } == ByteLiteral::cast_cchar(b'x')
|
||||||
|| unsafe { *s.offset(1) } == ByteLiteral::cast_cchar(b'X')))
|
|| unsafe { *s.add(1) } == ByteLiteral::cast_cchar(b'X')))
|
||||||
{
|
{
|
||||||
unsafe { convert_integer(s.offset(2), 16) }
|
unsafe { convert_integer(s.add(2), 16) }
|
||||||
.map(|(val, idx, overflow)| (val, idx + 2, overflow))
|
.map(|(val, idx, overflow)| (val, idx + 2, overflow))
|
||||||
} else {
|
} else {
|
||||||
unsafe { convert_integer(s, 16) }
|
unsafe { convert_integer(s, 16) }
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ impl State {
|
|||||||
|
|
||||||
let stash_value: u32 =
|
let stash_value: u32 =
|
||||||
(u32::from(self.n) << 16) | (u32::from(self.i) << 8) | u32::from(self.j);
|
(u32::from(self.n) << 16) | (u32::from(self.i) << 8) | u32::from(self.j);
|
||||||
unsafe { *self.x_ptr.offset(-1) = stash_value.to_ne_bytes() };
|
unsafe { *self.x_ptr.sub(1) = stash_value.to_ne_bytes() };
|
||||||
unsafe { self.x_ptr.offset(-1) }
|
unsafe { self.x_ptr.sub(1) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn load(&mut self, state_ptr: *mut [u8; 4]) {
|
pub unsafe fn load(&mut self, state_ptr: *mut [u8; 4]) {
|
||||||
let stash_value = u32::from_ne_bytes(unsafe { *state_ptr });
|
let stash_value = u32::from_ne_bytes(unsafe { *state_ptr });
|
||||||
self.x_ptr = unsafe { state_ptr.offset(1) };
|
self.x_ptr = unsafe { state_ptr.add(1) };
|
||||||
|
|
||||||
/* This calculation of n does not have a bit mask in the musl
|
/* This calculation of n does not have a bit mask in the musl
|
||||||
* original, in principle resulting in a u16, but obtaining a value
|
* original, in principle resulting in a u16, but obtaining a value
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ pub unsafe extern "C" fn memcmp(s1: *const c_void, s2: *const c_void, n: size_t)
|
|||||||
}
|
}
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
a = unsafe { a.offset(1) };
|
a = unsafe { a.add(1) };
|
||||||
b = unsafe { b.offset(1) };
|
b = unsafe { b.add(1) };
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut a = a.cast::<u8>();
|
let mut a = a.cast::<u8>();
|
||||||
@@ -92,8 +92,8 @@ pub unsafe extern "C" fn memcmp(s1: *const c_void, s2: *const c_void, n: size_t)
|
|||||||
if unsafe { *a } != unsafe { *b } {
|
if unsafe { *a } != unsafe { *b } {
|
||||||
return c_int::from(unsafe { *a }) - c_int::from(unsafe { *b });
|
return c_int::from(unsafe { *a }) - c_int::from(unsafe { *b });
|
||||||
}
|
}
|
||||||
a = unsafe { a.offset(1) };
|
a = unsafe { a.add(1) };
|
||||||
b = unsafe { b.offset(1) };
|
b = unsafe { b.add(1) };
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
@@ -354,7 +354,7 @@ pub unsafe fn inner_strspn(s1: *const c_char, s2: *const c_char, cmp: bool) -> s
|
|||||||
|
|
||||||
while unsafe { *s2 } != 0 {
|
while unsafe { *s2 } != 0 {
|
||||||
set.insert(unsafe { *s2 } as usize);
|
set.insert(unsafe { *s2 } as usize);
|
||||||
s2 = unsafe { s2.offset(1) };
|
s2 = unsafe { s2.add(1) };
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
@@ -363,7 +363,7 @@ pub unsafe fn inner_strspn(s1: *const c_char, s2: *const c_char, cmp: bool) -> s
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
s1 = unsafe { s1.offset(1) };
|
s1 = unsafe { s1.add(1) };
|
||||||
}
|
}
|
||||||
i
|
i
|
||||||
}
|
}
|
||||||
@@ -638,7 +638,7 @@ unsafe fn inner_strstr(
|
|||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
haystack = unsafe { haystack.offset(1) };
|
haystack = unsafe { haystack.add(1) };
|
||||||
}
|
}
|
||||||
ptr::null_mut()
|
ptr::null_mut()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,12 +127,12 @@ pub unsafe extern "C" fn utimes(path: *const c_char, times: *const timeval) -> c
|
|||||||
} else {
|
} else {
|
||||||
Some([
|
Some([
|
||||||
timespec {
|
timespec {
|
||||||
tv_sec: unsafe { (*times.offset(0)).tv_sec },
|
tv_sec: unsafe { (*times).tv_sec },
|
||||||
tv_nsec: c_long::from(unsafe { (*times.offset(0)).tv_usec }) * 1000,
|
tv_nsec: c_long::from(unsafe { (*times).tv_usec }) * 1000,
|
||||||
},
|
},
|
||||||
timespec {
|
timespec {
|
||||||
tv_sec: unsafe { (*times.offset(1)).tv_sec },
|
tv_sec: unsafe { (*times.add(1)).tv_sec },
|
||||||
tv_nsec: c_long::from(unsafe { (*times.offset(1)).tv_usec }) * 1000,
|
tv_nsec: c_long::from(unsafe { (*times.add(1)).tv_usec }) * 1000,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -89,17 +89,17 @@ pub unsafe fn strftime<W: WriteByte>(w: &mut W, format: *const c_char, t: *const
|
|||||||
// If the character isn't '%', just copy it out.
|
// If the character isn't '%', just copy it out.
|
||||||
if unsafe { *format } as u8 != b'%' {
|
if unsafe { *format } as u8 != b'%' {
|
||||||
w!(byte unsafe { *format } as u8);
|
w!(byte unsafe { *format } as u8);
|
||||||
format = unsafe { format.offset(1) };
|
format = unsafe { format.add(1) };
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip '%'
|
// Skip '%'
|
||||||
format = unsafe { format.offset(1) };
|
format = unsafe { format.add(1) };
|
||||||
|
|
||||||
// POSIX says '%E' and '%O' can modify numeric formats for locales,
|
// POSIX says '%E' and '%O' can modify numeric formats for locales,
|
||||||
// but we ignore them in this minimal "C" locale approach.
|
// but we ignore them in this minimal "C" locale approach.
|
||||||
if unsafe { *format } as u8 == b'E' || unsafe { *format } as u8 == b'O' {
|
if unsafe { *format } as u8 == b'E' || unsafe { *format } as u8 == b'O' {
|
||||||
format = unsafe { format.offset(1) };
|
format = unsafe { format.add(1) };
|
||||||
}
|
}
|
||||||
|
|
||||||
match unsafe { *format } as u8 {
|
match unsafe { *format } as u8 {
|
||||||
@@ -270,7 +270,7 @@ pub unsafe fn strftime<W: WriteByte>(w: &mut W, format: *const c_char, t: *const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move past the format specifier
|
// Move past the format specifier
|
||||||
format = unsafe { format.offset(1) };
|
format = unsafe { format.add(1) };
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ pub unsafe extern "C" fn gethostname(mut name: *mut c_char, mut len: size_t) ->
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = unsafe { name.offset(1) };
|
name = unsafe { name.add(1) };
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ pub unsafe extern "C" fn wcsnlen(mut s: *const wchar_t, maxlen: size_t) -> size_
|
|||||||
}
|
}
|
||||||
|
|
||||||
len += 1;
|
len += 1;
|
||||||
s = unsafe { s.offset(1) };
|
s = unsafe { s.add(1) };
|
||||||
}
|
}
|
||||||
|
|
||||||
len
|
len
|
||||||
|
|||||||
+1
-1
@@ -230,7 +230,7 @@ impl Read for UnsafeStringReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*inner = *self.0;
|
*inner = *self.0;
|
||||||
self.0 = self.0.offset(1);
|
self.0 = self.0.add(1);
|
||||||
}
|
}
|
||||||
Ok(buf.len())
|
Ok(buf.len())
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -257,7 +257,7 @@ pub unsafe extern "C" fn relibc_start_v1(
|
|||||||
#[allow(clippy::op_ref)]
|
#[allow(clippy::op_ref)]
|
||||||
while f < &raw const __preinit_array_end {
|
while f < &raw const __preinit_array_end {
|
||||||
(unsafe { *f })();
|
(unsafe { *f })();
|
||||||
f = unsafe { f.offset(1) };
|
f = unsafe { f.add(1) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ pub unsafe extern "C" fn relibc_start_v1(
|
|||||||
#[allow(clippy::op_ref)]
|
#[allow(clippy::op_ref)]
|
||||||
while f < &raw const __init_array_end {
|
while f < &raw const __init_array_end {
|
||||||
(unsafe { *f })();
|
(unsafe { *f })();
|
||||||
f = unsafe { f.offset(1) };
|
f = unsafe { f.add(1) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user