File: alloc.h

package info (click to toggle)
zoem 04-173-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,316 kB
  • ctags: 1,716
  • sloc: ansic: 14,114; sh: 798; makefile: 206; perl: 14
file content (82 lines) | stat: -rw-r--r-- 1,907 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*      Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Stijn van Dongen
 *
 * This file is part of MCL.  You can redistribute and/or modify MCL under the
 * terms of the GNU General Public License; either version 2 of the License or
 * (at your option) any later version.  You should have received a copy of the
 * GPL along with MCL, in the file COPYING.
*/

#ifndef util_alloc_h
#define util_alloc_h


/* ========================================================================= *
 *
 *    mcxRealloc is notable, for it *frees* memory and returns a NULL pointer
 *    if the newly requested block has size 0.  This must be so in order to
 *    allow routines to do their math and housekeeping. If they register the
 *    new block as having 0 bytes, then they need not and must not attempt to
 *    free it thereafter.
 *
 * ========================================================================= *
*/

#include <stdlib.h>
#include <stdio.h>

#include "types.h"


void* mcxAlloc
(  int               size
,  mcxOnFail         ON_FAIL
)  ;

void* mcxRealloc
(  void*             object
,  int               new_size
,  mcxOnFail         ON_FAIL
)  ;

void mcxFree
(  void*             object
)  ;

void mcxNFree
(  void*             base
,  int               n_elem
,  int               elem_size
,  void            (*obRelease) (void *)
)  ;

void* mcxNAlloc
(  int               n_elem
,  int               elem_size
,  void*           (*obInit) (void *)
,  mcxOnFail         ON_FAIL
)  ;

void* mcxNRealloc
(  void*             mem
,  int               n_elem
,  int               n_elem_prev
,  int               elem_size
,  void* (*obInit) (void *)
,  mcxOnFail         ON_FAIL
)  ;

void mcxMemDenied
(  FILE*             channel
,  const char*       requestee
,  const char*       unittype
,  int               n
)  ;

void mcxAllocLimits
(  long  maxchunksize
,  long  maxtimes
)  ;


#endif