Annotation of hatari/src/memAlloc.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.