Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dthelp / parser / pass2 / parser / delfree.c
1 /* $XConsortium: delfree.c /main/3 1995/11/08 10:50:16 rswiston $ */
2 /* Copyright (c) 1988 Hewlett-Packard Co. */
3
4 /* Versions of m_free and m_malloc for debugging. */
5
6 /**/
7 #include <malloc.h>
8 #include <stdio.h>
9 #include "basic.h"
10 #include "trie.h"
11 #include "dtd.h"
12 #include "parser.h"
13
14 m_free(block, msg)
15   char *block ;
16   char *msg ;
17   {
18     free(block) ;
19     fprintf(m_outfile, "%5u:%5u- Freed     %s\n",
20       (unsigned int) ((unsigned long) block >> 16),
21       (unsigned int) block, msg) ;
22     }
23
24 char *m_mallocx(size, msg)
25   int size ;
26   char *msg ;
27   {
28     char *p ;
29
30     if (! size) return(NULL) ;
31     p = malloc(size) ;
32     if (! p) {
33       m_err1("Unable to allocate space for %s", msg) ;
34       exit(TRUE) ;
35       }
36     fprintf(m_outfile, "%5u:%5u- Allocated %s\n",
37       (unsigned int) ((unsigned long) p >> 16), (unsigned int) p, msg) ;
38     return(p) ;
39     }