Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dthelp / parser / pass2 / parser / delfree.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: delfree.c /main/3 1995/11/08 10:50:16 rswiston $ */
24 /* Copyright (c) 1988 Hewlett-Packard Co. */
25
26 /* Versions of m_free and m_malloc for debugging. */
27
28 /**/
29 #include <malloc.h>
30 #include <stdio.h>
31 #include "basic.h"
32 #include "trie.h"
33 #include "dtd.h"
34 #include "parser.h"
35
36 m_free(block, msg)
37   char *block ;
38   char *msg ;
39   {
40     free(block) ;
41     fprintf(m_outfile, "%5u:%5u- Freed     %s\n",
42       (unsigned int) ((unsigned long) block >> 16),
43       (unsigned int) block, msg) ;
44     }
45
46 char *m_mallocx(size, msg)
47   int size ;
48   char *msg ;
49   {
50     char *p ;
51
52     if (! size) return(NULL) ;
53     p = malloc(size) ;
54     if (! p) {
55       m_err1("Unable to allocate space for %s", msg) ;
56       exit(TRUE) ;
57       }
58     fprintf(m_outfile, "%5u:%5u- Allocated %s\n",
59       (unsigned int) ((unsigned long) p >> 16), (unsigned int) p, msg) ;
60     return(p) ;
61     }