Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Clean up some redundant casts
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 14, 2023
1 parent 7755559 commit d90d7ab
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub(crate) unsafe fn yaml_string_extend(
new_start.wrapping_offset((*end).c_offset_from(*start) as libc::c_long as isize)
as *mut libc::c_void,
0,
(*end).c_offset_from(*start) as libc::c_long as libc::c_ulong,
(*end).c_offset_from(*start) as libc::c_ulong,
);
*pointer = new_start.wrapping_offset((*pointer).c_offset_from(*start) as libc::c_long as isize);
*end = new_start.wrapping_offset(
Expand Down Expand Up @@ -88,7 +88,7 @@ pub(crate) unsafe fn yaml_string_join(
memcpy(
*a_pointer as *mut libc::c_void,
*b_start as *const libc::c_void,
(*b_pointer).c_offset_from(*b_start) as libc::c_long as libc::c_ulong,
(*b_pointer).c_offset_from(*b_start) as libc::c_ulong,
);
*a_pointer =
(*a_pointer).wrapping_offset((*b_pointer).c_offset_from(*b_start) as libc::c_long as isize);
Expand Down Expand Up @@ -149,7 +149,7 @@ pub(crate) unsafe fn yaml_queue_extend(
*start,
*head,
(*tail as *mut libc::c_char).c_offset_from(*head as *mut libc::c_char)
as libc::c_long as libc::c_ulong,
as libc::c_ulong,
);
}
*tail = (*start as *mut libc::c_char).wrapping_offset(
Expand Down
4 changes: 2 additions & 2 deletions src/dumper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ pub unsafe fn yaml_emitter_dump(
*fresh1 = yaml_malloc(
(size_of::<yaml_anchors_t>() as libc::c_ulong)
.force_mul((*document).nodes.top.c_offset_from((*document).nodes.start)
as libc::c_long as libc::c_ulong),
as libc::c_ulong),
) as *mut yaml_anchors_t;
memset(
(*emitter).anchors as *mut libc::c_void,
0,
(size_of::<yaml_anchors_t>() as libc::c_ulong)
.force_mul((*document).nodes.top.c_offset_from((*document).nodes.start)
as libc::c_long as libc::c_ulong),
as libc::c_ulong),
);
memset(
event as *mut libc::c_void,
Expand Down
2 changes: 1 addition & 1 deletion src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ unsafe fn yaml_emitter_analyze_tag(emitter: *mut yaml_emitter_t, tag: *mut yaml_
let fresh49 = addr_of_mut!((*emitter).tag_data.suffix);
*fresh49 = string.start.wrapping_offset(prefix_length as isize);
(*emitter).tag_data.suffix_length = (string.end.c_offset_from(string.start)
as libc::c_long as libc::c_ulong)
as libc::c_ulong)
.wrapping_sub(prefix_length);
return OK;
}
Expand Down
7 changes: 3 additions & 4 deletions src/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,9 @@ unsafe fn yaml_parser_save_simple_key(parser: *mut yaml_parser_t) -> Success {
let simple_key = yaml_simple_key_t {
possible: true,
required,
token_number: (*parser)
.tokens_parsed
.force_add((*parser).tokens.tail.c_offset_from((*parser).tokens.head)
as libc::c_long as libc::c_ulong),
token_number: (*parser).tokens_parsed.force_add(
(*parser).tokens.tail.c_offset_from((*parser).tokens.head) as libc::c_ulong,
),
mark: (*parser).mark,
};
if yaml_parser_remove_simple_key(parser).fail {
Expand Down

0 comments on commit d90d7ab

Please sign in to comment.