Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8335 maxcodehac 1
 
2
   GNU UnRTF, a command-line program to convert RTF documents to other formats.
3
   Copyright (C) 2000,2001 Zachary Thayer Smith
4
5
 
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation; either version 2 of the License, or
8
   (at your option) any later version.
9
10
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
   GNU General Public License for more details.
14
15
 
16
   along with this program; if not, write to the Free Software
17
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19
 
20
=============================================================================*/
21
22
 
23
 
24
 * Module name:    malloc
25
 * Author name:    Zach Smith
26
 * Create date:    01 Aug 01
27
 * Purpose:        Memory management. Allows us to keep track of how
28
 *                 much memory is being used.
29
 *----------------------------------------------------------------------
30
 * Changes:
31
 * 14 Aug 01, tuorfa@yahoo.com: added Turbo C support.
32
 * 16 Aug 01, Lars Unger : added Amiga/GCC support.
33
 * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
34
 * 28 Sep 01, tuorfa@yahoo.com: removed Turbo C support.
35
 *--------------------------------------------------------------------*/
36
37
 
38
 
39
#include 
40
41
 
42
#include 
43
#else
44
#include 
45
#endif
46
47
 
48
49
 
50
 
51
52
 
53
 
54
 
55
 * Name:	my_malloc
56
 * Purpose:	Internal version of malloc necessary for record keeping.
57
 * Args:	Amount.
58
 * Returns:	Pointer.
59
 *=======================================================================*/
60
61
 
62
my_malloc (unsigned long size) {
63
	char *ptr;
64
65
 
66
	if (ptr)
67
		count += size;
68
69
 
70
}
71
72
 
73
 * Name:	my_free
74
 * Purpose:	Internal version of free necessary for record keeping.
75
 * Args:	Pointer.
76
 * Returns:	None.
77
 *=======================================================================*/
78
79
 
80
my_free (char* ptr) {
81
	CHECK_PARAM_NOT_NULL(ptr);
82
83
 
84
}
85
86
 
87
 
88
 
89
 * Name:	total_malloced
90
 * Purpose:	Returns total amount of memory thus far allocated.
91
 * Args:	None.
92
 * Returns:	Amount.
93
 *=======================================================================*/
94
95
 
96
total_malloced (void) {
97
	return count;
98
}
99
100
 
101
 
102
 
103
 * Name:	my_strdup
104
 * Purpose:	Internal version of strdup necessary for record keeping.
105
 * Args:	String.
106
 * Returns:	String.
107
 *=======================================================================*/
108
109
 
110
my_strdup (char *src) {
111
	unsigned long len;
112
	char *ptr;
113
114
 
115
116
 
117
	ptr = my_malloc (len+1);
118
	if (!ptr)
119
		error_handler ("out of memory in strdup()");
120
121
 
122
	return ptr;
123
}
124