aboutsummaryrefslogtreecommitdiff
path: root/ft_strdup.s
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-14 15:47:21 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-14 15:47:21 +0100
commit94d61d8aaee7a3df0dc1f055e27e0f4484cb3ffa (patch)
tree932c0e5d40822e8d98ad04485c6f7fc088c31c09 /ft_strdup.s
parent6808cd0fbd3edf68422228d2ee6a41ad70f971d5 (diff)
downloadlibasm-94d61d8aaee7a3df0dc1f055e27e0f4484cb3ffa.tar.gz
libasm-94d61d8aaee7a3df0dc1f055e27e0f4484cb3ffa.tar.bz2
libasm-94d61d8aaee7a3df0dc1f055e27e0f4484cb3ffa.zip
Linux version without '_' prefix
Diffstat (limited to 'ft_strdup.s')
-rw-r--r--ft_strdup.s16
1 files changed, 8 insertions, 8 deletions
diff --git a/ft_strdup.s b/ft_strdup.s
index a31f36f..b5420ac 100644
--- a/ft_strdup.s
+++ b/ft_strdup.s
@@ -10,27 +10,27 @@
; ;
; **************************************************************************** ;
-extern _ft_strlen
-extern _ft_strcpy
-extern _malloc
+extern ft_strlen
+extern ft_strcpy
+extern malloc
-global _ft_strdup
+global ft_strdup
; char *ft_strdup(const char *str);
-_ft_strdup:
+ft_strdup:
push rdi ; save rdi because it will be overwrite for malloc
- call _ft_strlen ; rdi is still == str
+ call ft_strlen ; rdi is still == str
inc rax ; len++ for '\0'
mov rdi, rax ; size to malloc
- call _malloc
+ call malloc
cmp rax, 0
je FT_STRDUP_ERROR
pop rsi ; original str as src
mov rdi, rax ; allocated as dest
- call _ft_strcpy
+ call ft_strcpy
ret
FT_STRDUP_ERROR:
pop rdi