File: memory.c

package info (click to toggle)
iqtree 1.5.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,780 kB
  • ctags: 11,529
  • sloc: cpp: 96,162; ansic: 59,874; python: 242; sh: 189; makefile: 45
file content (27 lines) | stat: -rwxr-xr-x 458 bytes parent folder | download | duplicates (25)
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
#include <stdio.h>
#include <stdlib.h>

#ifdef __STDC__
void *_mymalloc(long size, int line, char *message)
#else
void *_mymalloc(size, line, message)
long size;
int line;
char *message;
#endif
{
  char *temp;

  if(size == 0)
    return NULL;

  temp = (char *) malloc(size);
  
  if(temp == NULL)
    {
      fprintf(stderr,"\nmemory allocation failure in file: %s at line number: %d\n", message, line);
      return NULL;
    }

  return (void *) temp;
}