From e04f1d8cb0c13726c877766405993705005b1e22 Mon Sep 17 00:00:00 2001 From: uz Date: Mon, 12 Nov 2012 23:07:02 +0000 Subject: [PATCH] Fixed an error in calloc reported by Marc 'BlackJack' Rintsch. git-svn-id: svn://svn.cc65.org/cc65/trunk@5932 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/common/calloc.s | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libsrc/common/calloc.s b/libsrc/common/calloc.s index 16d217553..2a66a7d1b 100644 --- a/libsrc/common/calloc.s +++ b/libsrc/common/calloc.s @@ -7,8 +7,8 @@ ; .export _calloc - .import _malloc, _memset - .import tosumulax, pushax, push0 + .import _malloc, __bzero + .import tosumulax, pushax ; ------------------------------------------------------------------------- @@ -35,21 +35,20 @@ cpx #0 bne ClearBlock cmp #0 - beq ClearBlock + bne ClearBlock ; We have a NULL pointer, bail out rts -; No NULL pointer, clear the block. memset will return a pointer to the +; No NULL pointer, clear the block. _bzero will return a pointer to the ; block which is exactly what we want. ClearBlock: jsr pushax ; ptr - jsr push0 ; #0 lda Size - ldx Size+1 ; Size - jmp _memset + ldx Size+1 ; Size + jmp __bzero .endproc -- 2.39.5