/[dtapublic]/projs/ets/trunk/src/lib_c/c_datd/memory/cmalloc.c
ViewVC logotype

Contents of /projs/ets/trunk/src/lib_c/c_datd/memory/cmalloc.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 244 - (show annotations) (download)
Sun Aug 5 19:05:46 2018 UTC (6 years, 2 months ago) by dashley
File MIME type: text/plain
File size: 2997 byte(s)
Reorganize.  Get formatted string functions working.
1 //$Header$
2 //{9271a56e-a39a-4ba3-af90-c665b60de5e5}
3 //-------------------------------------------------------------------------------------------------
4 //This file is part of "Embedded Tool Set", a tool set designed to facilitate embedded system
5 //software and hardware development.
6 //-------------------------------------------------------------------------------------------------
7 //This source code and any program in which it is compiled/used is provided under the MIT License,
8 //reproduced below.
9 //-------------------------------------------------------------------------------------------------
10 //Permission is hereby granted, free of charge, to any person obtaining a copy of
11 //this software and associated documentation files(the "Software"), to deal in the
12 //Software without restriction, including without limitation the rights to use,
13 //copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the
14 //Software, and to permit persons to whom the Software is furnished to do so,
15 //subject to the following conditions :
16 //
17 //The above copyright notice and this permission notice shall be included in all
18 //copies or substantial portions of the Software.
19 //
20 //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
23 //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 //SOFTWARE.
27 //-------------------------------------------------------------------------------------------------
28 #define MODULE_CMALLOC
29
30 #include <malloc.h>
31 #include <process.h>
32 #include <stdio.h>
33
34 #include "cmalloc.h"
35
36 #include "../../c_cmode/ccmfatal.h"
37
38
39 void *CMALLOC_malloc( size_t size )
40 {
41 void *rv;
42
43 rv = malloc(size);
44
45 if (!rv)
46 {
47 CCMFATAL_fatal("NULL pointer from malloc()--probable out of memory.",
48 __FILE__,
49 __LINE__);
50 }
51
52 return(rv);
53 }
54
55
56 void *CMALLOC_calloc( size_t num, size_t size )
57 {
58 void *rv;
59
60 rv = calloc(num, size);
61
62 if (!rv)
63 {
64 CCMFATAL_fatal("NULL pointer from calloc()--probable out of memory.",
65 __FILE__,
66 __LINE__);
67 }
68
69 return(rv);
70 }
71
72 void *CMALLOC_realloc( void *memblock, size_t size )
73 {
74 void *rv;
75
76 rv = realloc(memblock, size);
77
78 if ((!rv) && (size))
79 {
80 CCMFATAL_fatal("NULL pointer from realloc()--probable out of memory.",
81 __FILE__,
82 __LINE__);
83 }
84
85 return(rv);
86 }
87
88
89 void CMALLOC_free( void *memblock )
90 {
91 free(memblock);
92 }
93
94
95 const char *CMALLOC_cvcinfo(void)
96 {
97 return("$Header$");
98 }
99
100
101 const char *CMALLOC_hvcinfo(void)
102 {
103 return(CMALLOC_H_VERSION);
104 }
105
106 //End of cmalloc.c.

Properties

Name Value
svn:eol-style native
svn:keywords Header

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25