diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-11 15:40:48 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-11 15:40:48 +0100 |
| commit | cd5c9e6a923878e797212d27476ee217eb844a14 (patch) | |
| tree | f5ea8605d0521cbfbf384b05567bf3d2155b0b45 /ft_list_remove_if.s | |
| parent | 28424105e255f0a4c887b6e6a83afd6dce372709 (diff) | |
| download | libasm-cd5c9e6a923878e797212d27476ee217eb844a14.tar.gz libasm-cd5c9e6a923878e797212d27476ee217eb844a14.tar.bz2 libasm-cd5c9e6a923878e797212d27476ee217eb844a14.zip | |
Added Linux compatibility
Diffstat (limited to 'ft_list_remove_if.s')
| -rw-r--r-- | ft_list_remove_if.s | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/ft_list_remove_if.s b/ft_list_remove_if.s index 5a2fd8b..7ce06a0 100644 --- a/ft_list_remove_if.s +++ b/ft_list_remove_if.s @@ -10,9 +10,17 @@ ; ; ; **************************************************************************** ; -global _ft_list_remove_if +%ifdef __LINUX__ + %define M_FT_LIST_REMOVE_IF ft_list_remove_if + %define M_FREE free +%else + %define M_FT_LIST_REMOVE_IF _ft_list_remove_if + %define M_FREE _free +%endif -extern _free +global M_FT_LIST_REMOVE_IF + +extern M_FREE %define NULL 0x0 @@ -33,7 +41,7 @@ extern _free ; ft_list_remove_if(t_list **begin_list, void *data_ref, ; int (*cmp)(void *data, void *data_ref), ; void (*free_fct)(void *)) -_ft_list_remove_if: +M_FT_LIST_REMOVE_IF: ; t_list *saved_next ; === prolog === @@ -50,7 +58,7 @@ _ft_list_remove_if: ; === compare (*begin_list)->data and data_ref EXTERN_FUNCTION_SAVE mov rdi, [rdi] - mov rdi, [rdi + 0] + mov rdi, [rdi + 0] call rdx ; cmp((*begin_list)->data, data_ref) EXTERN_FUNCTION_SAVE_END cmp rax, 0 @@ -60,7 +68,7 @@ _ft_list_remove_if: push rdi mov rdi, [rdi] lea rdi, [rdi + 8] - call _ft_list_remove_if + call M_FT_LIST_REMOVE_IF pop rdi jmp FT_LIST_REMOVE_IF_END @@ -80,12 +88,12 @@ FT_LIST_REMOVE_IF_REMOVE: EXTERN_FUNCTION_SAVE mov rdi, [rdi] - call _free ; free(*begin_list) + call M_FREE wrt ..plt ; free(*begin_list) EXTERN_FUNCTION_SAVE_END mov rax, [rbp - 8] mov [rdi], rax - call _ft_list_remove_if + call M_FT_LIST_REMOVE_IF FT_LIST_REMOVE_IF_END: ; === epilog === |
