|
|
1.1 root 1: /*
2: Hatari
3:
4: Memory Functions
5: */
6:
7: #include "main.h"
8: #include "memAlloc.h"
9:
1.1.1.2 ! root 10:
! 11: /*-----------------------------------------------------------------------*/
1.1 root 12: /*
13: Allocate memory from Windows
14: */
15: void *Memory_Alloc(int nBytes)
16: {
17: void *pAlloc;
18:
1.1.1.2 ! root 19: /* Allocate our memory */
1.1 root 20: pAlloc = malloc(nBytes);
21: if (pAlloc==NULL) {
22: Main_SysError("Out of Memory!\n\nPlease close all running applications and\ncheck you are not running low on disc space.\n",PROG_NAME);
23: exit(0);
24: }
25:
26: return(pAlloc);
27: }
28:
1.1.1.2 ! root 29:
! 30: /*-----------------------------------------------------------------------*/
1.1 root 31: /*
32: Free memory back to Windows
33: */
34: void Memory_Free(void *pAlloc)
35: {
1.1.1.2 ! root 36: /* Free our memory */
1.1 root 37: free(pAlloc);
38: }
39:
1.1.1.2 ! root 40:
! 41: /*-----------------------------------------------------------------------*/
1.1 root 42: /*
43: Set memory block to byte value
44: */
45: void *Memory_Set(void *pAlloc, int c, size_t count)
46: {
1.1.1.2 ! root 47: /* Set memory region */
1.1 root 48: return(memset(pAlloc,c,count));
49: }
50:
1.1.1.2 ! root 51:
! 52: /*-----------------------------------------------------------------------*/
1.1 root 53: /*
54: Set memory block to zero
55: */
56: void *Memory_Clear(void *pAlloc, size_t count)
57: {
1.1.1.2 ! root 58: /* Clear out memory region */
1.1 root 59: return(memset(pAlloc,0x0,count));
60: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.