ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/hybrid-ircservices-1/memory.h
Revision: 1209
Committed: Thu Aug 25 19:05:49 2011 UTC (12 years, 7 months ago) by michael
Content type: text/x-chdr
File size: 2435 byte(s)
Log Message:
- run everything thru indent
  "-bli0 -di1 -npcs -nut -cdw -bls -nbbo -bap"

File Contents

# Content
1 /* Memory management include file.
2 *
3 * IRC Services is copyright (c) 1996-2009 Andrew Church.
4 * E-mail: <achurch@achurch.org>
5 * Parts written by Andrew Kempe and others.
6 * This program is free but copyrighted software; see the file GPL.txt for
7 * details.
8 */
9
10 #ifndef MEMORY_H
11 #define MEMORY_H
12
13 /*************************************************************************/
14
15 #if MEMCHECKS
16 # define FILELINE , const char *file, int line
17 #else
18 # define FILELINE /*nothing */
19 #endif
20 extern void *smalloc(long size FILELINE);
21 extern void *scalloc(long els, long elsize FILELINE);
22 extern void *srealloc(void *oldptr, long newsize FILELINE);
23 extern char *sstrdup(const char *s FILELINE);
24 #undef FILELINE
25
26 #if MEMCHECKS
27
28 # if SHOWALLOCS
29 extern int showallocs;
30 # endif
31 extern void init_memory(void);
32 extern void uninit_memory(void);
33 extern void *MCmalloc(long size, const char *file, int line);
34 extern void *MCcalloc(long elsize, long els, const char *file, int line);
35 extern void *MCrealloc(void *oldptr, long newsize, const char *file,
36 int line);
37 extern void MCfree(void *ptr, const char *file, int line);
38 extern char *MCstrdup(const char *s, const char *file, int line);
39
40 #else /* !MEMCHECKS */
41
42 # define init_memory() /*nothing */
43 # define uninit_memory() /*nothing */
44
45 #endif
46
47 /*************************************************************************/
48
49 #if MEMCHECKS && !defined(NO_MEMREDEF)
50
51 # undef malloc
52 # undef calloc
53 # undef realloc
54 # undef free
55 # undef strdup
56
57 # define malloc(size) MCmalloc(size,__FILE__,__LINE__)
58 # define calloc(elsize,els) MCcalloc(elsize,els,__FILE__,__LINE__)
59 # define realloc(ptr,size) MCrealloc(ptr,size,__FILE__,__LINE__)
60 # define free(ptr) MCfree(ptr,__FILE__,__LINE__)
61 # define strdup(str) MCstrdup(str,__FILE__,__LINE__)
62
63 # define smalloc(size) smalloc(size,__FILE__,__LINE__)
64 # define scalloc(elsize,els) scalloc(elsize,els,__FILE__,__LINE__)
65 # define srealloc(ptr,size) srealloc(ptr,size,__FILE__,__LINE__)
66 # define sstrdup(str) sstrdup(str,__FILE__,__LINE__)
67
68 #endif /* MEMCHECKS && !NO_MEMREDEF */
69
70 /*************************************************************************/
71
72 #endif /* MEMORY_H */
73
74 /*
75 * Local variables:
76 * c-file-style: "stroustrup"
77 * c-file-offsets: ((case-label . *) (statement-case-intro . *))
78 * indent-tabs-mode: nil
79 * End:
80 *
81 * vim: expandtab shiftwidth=4:
82 */