From 8012074ea0875cf15de6c9f4441a8bb185b71336 Mon Sep 17 00:00:00 2001 From: cuz Date: Sat, 1 Feb 2003 10:20:35 +0000 Subject: [PATCH] Renamed _hadd to _heapadd git-svn-id: svn://svn.cc65.org/cc65/trunk@1911 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- include/stdlib.h | 5 +++-- libsrc/common/Makefile | 2 +- libsrc/common/{_hadd.s => _heapadd.s} | 11 ++++++----- libsrc/common/free.s | 11 ++++++----- 4 files changed, 16 insertions(+), 13 deletions(-) rename libsrc/common/{_hadd.s => _heapadd.s} (85%) diff --git a/include/stdlib.h b/include/stdlib.h index de322555d..166eb743a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -57,7 +57,8 @@ void* __fastcall__ malloc (size_t size); void* __fastcall__ calloc (size_t count, size_t size); void* __fastcall__ realloc (void* block, size_t size); void __fastcall__ free (void* block); -void __fastcall__ _hadd (void* mem, size_t size); /* Non-standard */ +/* Non standard functions */ +void __fastcall__ _heapadd (void* mem, size_t size); /* Random numbers */ #define RAND_MAX 0x7FFF @@ -75,7 +76,7 @@ int __fastcall__ atexit (void (*exitfunc) (void)); void* bsearch (const void* key, const void* base, size_t n, size_t size, int (*cmp) (const void*, const void*)); div_t __fastcall__ div (int numer, int denom); -void __fastcall__ exit (int ret); +void __fastcall__ exit (int ret); char* __fastcall__ getenv (const char* name); void qsort (void* base, size_t count, size_t size, int (*compare) (const void*, const void*)); diff --git a/libsrc/common/Makefile b/libsrc/common/Makefile index 3e361bb25..d15852fd4 100644 --- a/libsrc/common/Makefile +++ b/libsrc/common/Makefile @@ -52,8 +52,8 @@ C_OBJS = _afailed.o \ S_OBJS = _fdesc.o \ _file.o \ _fopen.o \ - _hadd.o \ _heap.o \ + _heapadd.o \ _oserror.o \ _printf.o \ _swap.o \ diff --git a/libsrc/common/_hadd.s b/libsrc/common/_heapadd.s similarity index 85% rename from libsrc/common/_hadd.s rename to libsrc/common/_heapadd.s index 7032c6502..d6703e820 100644 --- a/libsrc/common/_hadd.s +++ b/libsrc/common/_heapadd.s @@ -3,14 +3,14 @@ ; ; Add a block to the heap free list ; -; void __fastcall__ _hadd (void* mem, size_t size); +; void __fastcall__ _heapadd (void* mem, size_t size); ; ; .importzp ptr1, ptr2 .import popax - .import hadd - .export _hadd + .import heapadd + .export _heapadd .macpack generic @@ -25,7 +25,8 @@ min_size = 6 ; Code -_hadd: sta ptr1 ; Store size in ptr1 +_heapadd: + sta ptr1 ; Store size in ptr1 stx ptr1+1 jsr popax ; Get the block pointer sta ptr2 @@ -53,7 +54,7 @@ _hadd: sta ptr1 ; Store size in ptr1 ; Call the internal function since variables are now setup correctly - jmp hadd + jmp heapadd diff --git a/libsrc/common/free.s b/libsrc/common/free.s index 06ccd135b..62a9122c6 100644 --- a/libsrc/common/free.s +++ b/libsrc/common/free.s @@ -61,7 +61,7 @@ .importzp ptr1, ptr2, ptr3, ptr4 .import __hptr, __hfirst, __hlast, __hend - .export _free, hadd + .export _free, heapadd .macpack generic @@ -107,9 +107,9 @@ _free: sta ptr2 lda ptr2+1 adc ptr1+1 cpy __hptr - bne hadd ; Add to free list + bne heapadd ; Add to free list cmp __hptr+1 - bne hadd + bne heapadd ; The pointer is located at the heap top. Lower the heap top pointer to ; release the block. @@ -278,7 +278,8 @@ _free: sta ptr2 ; Check if the free list is empty, storing _hfirst into ptr3 for later -hadd: lda __hfirst +heapadd: + lda __hfirst sta ptr3 lda __hfirst+1 sta ptr3+1 @@ -287,7 +288,7 @@ hadd: lda __hfirst ; The free list is empty, so this is the first and only block. A contains ; zero if we come here. - + ldy #next-1 @L2: iny ; f->next = f->prev = 0; sta (ptr2),y -- 2.39.5