stm32/ipcc: naming

This commit is contained in:
xoviat 2023-05-20 10:20:35 -05:00
parent 5e86188c25
commit 383bef1711

View File

@ -30,29 +30,29 @@ impl Default for LinkedListNode {
} }
impl LinkedListNode { impl LinkedListNode {
pub unsafe fn init_head(mut listHead: *mut LinkedListNode) { pub unsafe fn init_head(mut list_head: *mut LinkedListNode) {
(*listHead).next = listHead; (*list_head).next = list_head;
(*listHead).prev = listHead; (*list_head).prev = list_head;
} }
pub unsafe fn is_empty(mut listHead: *mut LinkedListNode) -> bool { pub unsafe fn is_empty(mut list_head: *mut LinkedListNode) -> bool {
interrupt::free(|_| ((*listHead).next) == listHead) interrupt::free(|_| ((*list_head).next) == list_head)
} }
pub unsafe fn insert_head(mut listHead: *mut LinkedListNode, mut node: *mut LinkedListNode) { pub unsafe fn insert_head(mut list_head: *mut LinkedListNode, mut node: *mut LinkedListNode) {
interrupt::free(|_| { interrupt::free(|_| {
(*node).next = (*listHead).next; (*node).next = (*list_head).next;
(*node).prev = listHead; (*node).prev = list_head;
(*listHead).next = node; (*list_head).next = node;
(*(*node).next).prev = node; (*(*node).next).prev = node;
}); });
} }
pub unsafe fn insert_tail(mut listHead: *mut LinkedListNode, mut node: *mut LinkedListNode) { pub unsafe fn insert_tail(mut list_head: *mut LinkedListNode, mut node: *mut LinkedListNode) {
interrupt::free(|_| { interrupt::free(|_| {
(*node).next = listHead; (*node).next = list_head;
(*node).prev = (*listHead).prev; (*node).prev = (*list_head).prev;
(*listHead).prev = node; (*list_head).prev = node;
(*(*node).prev).next = node; (*(*node).prev).next = node;
}); });
} }
@ -64,17 +64,17 @@ impl LinkedListNode {
}); });
} }
pub unsafe fn remove_head(mut listHead: *mut LinkedListNode, mut node: *mut *mut LinkedListNode) { pub unsafe fn remove_head(mut list_head: *mut LinkedListNode, mut node: *mut *mut LinkedListNode) {
interrupt::free(|_| { interrupt::free(|_| {
*node = (*listHead).next; *node = (*list_head).next;
Self::remove_node((*listHead).next); Self::remove_node((*list_head).next);
}); });
} }
pub unsafe fn remove_tail(mut listHead: *mut LinkedListNode, mut node: *mut *mut LinkedListNode) { pub unsafe fn remove_tail(mut list_head: *mut LinkedListNode, mut node: *mut *mut LinkedListNode) {
interrupt::free(|_| { interrupt::free(|_| {
*node = (*listHead).prev; *node = (*list_head).prev;
Self::remove_node((*listHead).prev); Self::remove_node((*list_head).prev);
}); });
} }
@ -96,13 +96,13 @@ impl LinkedListNode {
}); });
} }
pub unsafe fn get_size(mut listHead: *mut LinkedListNode) -> usize { pub unsafe fn get_size(mut list_head: *mut LinkedListNode) -> usize {
interrupt::free(|_| { interrupt::free(|_| {
let mut size = 0; let mut size = 0;
let mut temp: *mut LinkedListNode = core::ptr::null_mut::<LinkedListNode>(); let mut temp: *mut LinkedListNode = core::ptr::null_mut::<LinkedListNode>();
temp = (*listHead).next; temp = (*list_head).next;
while temp != listHead { while temp != list_head {
size += 1; size += 1;
temp = (*temp).next temp = (*temp).next
} }