aboutsummaryrefslogtreecommitdiff
path: root/ft_strdup.s
diff options
context:
space:
mode:
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