~wattazoum/albert/albert-mod

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef MEMORY_ROUTINES_H_
#define MEMORY_ROUTINES_H_

#include <stdlib.h>

/*******************************************************************/
/* MODIFIES: None.                                                 */
/* REQUIRES:                                                       */
/*     size -- amount of space needs to be allocated.              */ 
/* RETURNS:                                                        */
/*     Pointer to allocated block of size size.                    */ 
/*******************************************************************/
static char *Mymalloc(size)
int size;
{
    void No_memory_panic();

    char *temp;

    if (size <= 0) {
        fprintf(stderr,"\n Severe. Trying to allocate 0 bytes. \n");
        return(NULL);
    }

    temp = malloc(size);

    if (temp == NULL)
        No_memory_panic();
    return(temp);
}


#endif /*MEMORY_ROUTINES_H_*/