aboutsummaryrefslogtreecommitdiff
path: root/ft_strdup.s
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-04-12 19:54:39 +0200
committerCharles <sircharlesaze@gmail.com>2020-04-12 19:54:39 +0200
commit8529228d532fffedf20fc892467c7676121f219a (patch)
tree472d86a454ba9402affdf0e8edd8cc3c47b0f4c1 /ft_strdup.s
parent28424105e255f0a4c887b6e6a83afd6dce372709 (diff)
parent94d61d8aaee7a3df0dc1f055e27e0f4484cb3ffa (diff)
downloadlibasm-linux.tar.gz
libasm-linux.tar.bz2
libasm-linux.zip
Added change in ft_write, ft_readlinux
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