]> git.sesse.net Git - pgn-extract/blob - mymalloc.c
Push through a computer/human flag to the binary output.
[pgn-extract] / mymalloc.c
1 /*
2  *  Program: pgn-extract: a Portable Game Notation (PGN) extractor.
3  *  Copyright (C) 1994-2014 David Barnes
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 1, or (at your option)
7  *  any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  *
18  *  David Barnes may be contacted as D.J.Barnes@kent.ac.uk
19  *  http://www.cs.kent.ac.uk/people/staff/djb/
20  *
21  */
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include "mymalloc.h"
25
26 void *
27 MallocOrDie(size_t nbytes)
28 {   void *result;
29
30     result = malloc(nbytes);
31     if(result == NULL){
32         perror("Malloc Or Die");
33         abort();
34     }
35     return result;
36 }
37
38 void *
39 ReallocOrDie(void *space,size_t nbytes)
40 {   void *result;
41
42     result = realloc(space,nbytes);
43     if(result == NULL){
44         perror("Realloc Or Die");
45         abort();
46     }
47     return result;
48 }