1
2 /*
3 * Diverse Bristol audio routines.
4 * Copyright (c) by Nick Copeland <nickycopeland@hotmail.com> 1996,2012
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22 #include <stdlib.h> /* only for init library */
23
24 #include "bristol.h"
25
26 void *
bristolmalloc(size)27 bristolmalloc(size)
28 {
29 char *mem;
30
31 mem = malloc(size);
32
33 #ifdef DEBUG
34 printf("bristolmalloc: %x, %i\n", mem, size);
35 #endif
36
37 return(mem);
38 }
39
40 void *
bristolmalloc0(size)41 bristolmalloc0(size)
42 {
43 char *mem;
44
45 mem = bristolmalloc(size);
46
47 #ifdef DEBUG
48 printf("bristolmalloc0: %x, %i\n", mem, size);
49 #endif
50
51 bzero(mem, size);
52
53 return(mem);
54 }
55
56 void
bristolfree(void * mem)57 bristolfree(void *mem)
58 {
59 #ifdef DEBUG
60 printf("bristolfree: %x\n", mem);
61 #endif
62
63 if (mem != NULL)
64 free(mem);
65 #ifdef DEBUG
66 else
67 printf("attempt to free (null)\n");
68 #endif
69 }
70
71 void
bristolbzero(char * mem,int count)72 bristolbzero(char *mem, int count)
73 {
74 #ifdef DEBUG
75 printf("bristolzero: %x\n", mem);
76 #endif
77
78 if (mem == NULL)
79 return;
80
81 bzero(mem, count);
82 }
83
84