X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=as%2Fhc08%2Flkstore.c;fp=as%2Fhc08%2Flkstore.c;h=0000000000000000000000000000000000000000;hb=4d083eb86c1055c201f3f82e80b0ff4a7e49cb66;hp=063e89c4d88cca7f6345bf14fe817cf4ea620b76;hpb=ccadc6c89f74c72232dc551f6d7047285c658b7f;p=fw%2Fsdcc diff --git a/as/hc08/lkstore.c b/as/hc08/lkstore.c deleted file mode 100644 index 063e89c4..00000000 --- a/as/hc08/lkstore.c +++ /dev/null @@ -1,50 +0,0 @@ -/* lkstore.c */ - -/* - * Allocated string storage module. - * - * 31-Oct-1997 by John Hartman - */ - -#include -#include -#include -#include "aslink.h" - -/* - * Allocate space for "str", copy str into new space - * Return a pointer to the allocated name, or NULL if out of memory - */ -char *StoreString( char *str ) -{ - /* To avoid wasting memory headers on small allocations, we - / allocate a big chunk and parcel it out as required. - / These static variables remember our hunk - */ - #define STR_STORE_HUNK 2000 - static char *pNextFree = NULL; - static int bytesLeft = 0; - - int length; - char *pStoredString; - - length = strlen( str ) + 1; /* what we need, including null */ - - if (length > bytesLeft) - { - /* no space. Allocate a new hunk. We lose the pointer to any - / old hunk. We don't care, as the names are never deleted. - */ - pNextFree = (char*)new( STR_STORE_HUNK ); - bytesLeft = STR_STORE_HUNK; - } - - /* Copy the name and terminating null into the name store */ - pStoredString = pNextFree; - memcpy( pStoredString, str, length ); - - pNextFree += length; - bytesLeft -= length; - - return pStoredString; -}