]> git.imager.perl.org - imager.git/blame - imio.h
- the setcolors() had a fencepost error making it impossible to
[imager.git] / imio.h
CommitLineData
9e8a1b08
TC
1#ifndef IMAGER_IMIO_H_
2#define IMAGER_IMIO_H_
02d1d628
AMH
3#include <stdio.h>
4#include <sys/stat.h>
02d1d628
AMH
5
6#include "log.h"
7
8
9/* #define MALLOC_DEBUG */
10
11#ifdef IMAGER_DEBUG_MALLOC
12
13#define mymalloc(x) (mymalloc_file_line((x), __FILE__, __LINE__))
fe6163bf 14#define myrealloc(x,y) (myrealloc_file_line((x),(y), __FILE__, __LINE__))
02d1d628
AMH
15#define myfree(x) (myfree_file_line((x), __FILE__, __LINE__))
16
aea697ad 17void malloc_state (void);
fe6163bf
AMH
18void* mymalloc_file_line (size_t size, char* file, int line);
19void myfree_file_line (void *p, char*file, int line);
20void* myrealloc_file_line(void *p, size_t newsize, char* file,int line);
21void* mymalloc_comm (int size, char *comm);
22void bndcheck_all (void);
02d1d628
AMH
23
24#else
25
26#define malloc_comm(a,b) (mymalloc(a))
fe6163bf 27void malloc_state(void);
02d1d628 28void* mymalloc(int size);
fe6163bf
AMH
29void myfree(void *p);
30void* myrealloc(void *p, size_t newsize);
02d1d628
AMH
31
32#endif /* IMAGER_MALLOC_DEBUG */
33
34
8047cbb5
AMH
35
36typedef struct i_mempool {
37 void **p;
38 unsigned int alloc;
39 unsigned int used;
40} i_mempool;
41
42void i_mempool_init(i_mempool *mp);
43void i_mempool_extend(i_mempool *mp);
44void *i_mempool_alloc(i_mempool *mp, size_t size);
45void i_mempool_destroy(i_mempool *mp);
46
47
48
02d1d628
AMH
49#ifdef _MSC_VER
50#undef min
51#undef max
52#endif
fe6163bf 53
4f68b48f
TC
54extern unsigned long i_utf8_advance(char const **p, int *len);
55
5473b91d 56/* XXX Shouldn't these go away? */
fe6163bf 57
b33c08f8
TC
58int i_min(int a,int b);
59int i_max(int x,int y);
02d1d628
AMH
60
61#endif