/[dtapublic]/projs/trunk/shared_source/c_cmode/ccmalloc.c
ViewVC logotype

Contents of /projs/trunk/shared_source/c_cmode/ccmalloc.c

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25