home *** CD-ROM | disk | FTP | other *** search
- /*
- #### # # # #
- # # # # # The FreeWare C library for
- # # ## ### # # # # ### RISC OS machines
- # # # # # # # # # # # ___________________________________
- # # #### ### ## # # # #
- # # # # # # # # # # Please refer to the accompanying
- #### ### #### # # ##### # ### documentation for conditions of use
- ________________________________________________________________________
-
- File: DeskMem.c.XCalls
- Author: Copyright © 1995 Julian Smith
- Version: 1.02 (17 Nov 1995)
- Purpose: Standard functions for allocating immovable bits of memory.
- History: 1.00 (07 Sep 1995) JS
- 1.01 (10 Nov 1995) JS Put more common code into
- Desk_DeskMem__XHandleError.
- 1.02 (17 Nov 1995) JS Put error handling into separate Error.c
- file.
- 1.03 (18 Nov 1995) JS Now uses Desk_DeskMem_Raw* macros.
- */
-
-
- #include "Desk.Debug.h"
- #include "Desk.Error.h"
-
- #include "Defs.h"
-
-
-
-
- void *Desk_DeskMem_Calloc( size_t num, size_t size)
- {
- void *ptr = Desk_DeskMem_RawCalloc( num, size);
- Desk_Debug5_Printf( Desk_error_PLACE "Desk_DeskMem_Calloc called, num=%i, size=%i\n", num, size);
- if ( ptr || num==0 || size==0) return ptr;
- return Desk_DeskMem__HandleError( size*num, NULL);
- }
-
-
- void *Desk_DeskMem_Malloc( size_t size)
- {
- void *ptr;
- Desk_Debug5_Printf( Desk_error_PLACE "Desk_DeskMem_Malloc called, size=%i\n", size);
- ptr = Desk_DeskMem_RawMalloc( size);
- if ( ptr || size==0) return ptr;
- return Desk_DeskMem__HandleError( size, NULL);
- }
-
-
- void *Desk_DeskMem_Realloc( void *oldptr, size_t size)
- {
- void *ptr;
- Desk_Debug5_Printf( Desk_error_PLACE "Desk_DeskMem_Realloc called, oldptr=0x%p, size=%i\n", oldptr, size);
- ptr = Desk_DeskMem_RawRealloc( oldptr, size);
- if ( ptr || size==0) return ptr;
- return Desk_DeskMem__HandleError( size, oldptr);
- }
-
-
- void Desk_DeskMem_Free( void *ptr)
- {
- Desk_Debug5_Printf( Desk_error_PLACE "Desk_DeskMem_Free called for ptr 0x%p\n", ptr);
- Desk_DeskMem_RawFree( ptr);
- }
-