From 3d808905f1045e177cf874bf5814f46ff795bfec Mon Sep 17 00:00:00 2001 From: gtament Date: Tue, 2 Sep 2014 20:15:13 +0000 Subject: [PATCH] Improved code style. Changed linkedlist_delete to linkedlist_unlink to make linkedlist.inc universal git-svn-id: svn://kolibrios.org@5085 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/usb/usbftdi/linkedlist.inc | 51 ++++++++++++++---------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/drivers/usb/usbftdi/linkedlist.inc b/drivers/usb/usbftdi/linkedlist.inc index d645568c7b..374b9c2b32 100644 --- a/drivers/usb/usbftdi/linkedlist.inc +++ b/drivers/usb/usbftdi/linkedlist.inc @@ -9,40 +9,37 @@ head dd 0 linkedlist_add: push ebx - mov ebx, [head] - mov [head], eax - mov [eax + node.next], ebx + mov ebx, [head] + mov [head], eax + mov [eax + node.next], ebx pop ebx - ret + ret -linkedlist_delete: +linkedlist_unlink: push ebx ecx - mov ebx, eax ; eax - pointer to node for delete - cmp eax, [head] - jz .unlink_head - + test eax, eax + jz .invalid_pointer + mov ebx, eax ; eax - pointer to node for unlink + cmp eax, [head] + jz .unlink_head .getnext: - cmp [ebx+node.next], eax - jz .unlink - cmp [ebx+node.next], 0 - jz .invalid_pointer - mov ebx, [ebx+node.next] - jmp .getnext - + cmp [ebx+node.next], eax + jz .unlink + cmp [ebx+node.next], 0 + jz .invalid_pointer + mov ebx, [ebx+node.next] + jmp .getnext .unlink: - mov ecx, [eax+node.next] - mov [ebx+node.next], ecx - jmp @f - + mov ecx, [eax+node.next] + mov [ebx+node.next], ecx + jmp @f .unlink_head: - mov ebx, [eax+node.next] - mov [head], ebx + mov ebx, [eax+node.next] + mov [head], ebx @@: - mov ecx, eax - call Kfree .invalid_pointer: pop ecx ebx - ret + ret linkedlist_isvalid: ;eax - pointer to check; returns zero if valid push ebx ecx @@ -65,8 +62,8 @@ linkedlist_isvalid: ;eax - pointer to check; returns zero if valid ret linkedlist_gethead: - mov eax, [head] - ret + mov eax, [head] + ret restore node restore node.next \ No newline at end of file