Subversion Repositories Kolibri OS

Rev

Rev 300 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 300 Rev 324
Line -... Line 1...
-
 
1
//#include "kolibc.h"
-
 
2
 
1
#include "kolibc.h"
3
#ifdef __cplusplus
-
 
4
extern "C" {
-
 
5
#endif /* __cplusplus */
-
 
6
 
-
 
7
typedef unsigned int dword;
-
 
8
typedef unsigned int size_t;
-
 
9
 
-
 
10
 
-
 
11
#define PINUSE_BIT    1
Line 2... Line 12...
2
 
12
#define CINUSE_BIT    2
3
#define PINUSE_BIT    1
13
#define INUSE_BITS    3
4
#define CINUSE_BIT    2
14
 
Line 39... Line 49...
39
};
49
typedef struct t_chunk* tchunkptr;
Line 40... Line 50...
40
 
50
typedef struct t_chunk* tbinptr;
41
typedef struct t_chunk* tchunkptr;
51
 
Line 42... Line 52...
42
typedef struct t_chunk* tbinptr;
52
typedef struct m_state 
43
 
53
{
44
struct m_state
54
  dword      smallmap;
45
{
55
  dword      treemap;
46
  dword      smallmap;
56
//  DWORD      dvsize;
47
  dword      treemap;
57
  dword      topsize;
Line 53... Line 63...
53
  dword      magic;
63
  tbinptr    treebins[32];
54
  struct m_chunk    smallbins[32];
64
};
55
  tbinptr    treebins[32];
65
 
56
};
66
 
Line 57... Line -...
57
 
-
 
58
#ifdef __cplusplus
-
 
59
extern "C" {
-
 
Line 60... Line 67...
60
#endif /* __cplusplus */
67
void _cdecl  mf_init();
61
 
-
 
62
extern struct m_state ms;
68
void* _cdecl dlmalloc(size_t);
63
 
69
void* _cdecl dlrealloc(void *,size_t);
64
void init_malloc(void* p);
70
void  _cdecl dlfree(void*);
65
void* mf_alloc(size_t);
-
 
66
void  mf_free(void*);
-
 
67
 
-
 
68
#ifdef __cplusplus
-
 
Line 69... Line 71...
69
}
71
 
Line 70... Line 72...
70
#endif /* __cplusplus */
72
 
71
 
73
dword compute_tree_index(size_t s);
Line 72... Line 74...
72
 
74
 
Line 73... Line 75...
73
dword compute_tree_index(size_t s);
75
static void insert_chunk(mchunkptr P, size_t S);
74
 
76
static void insert_large_chunk(tchunkptr X, size_t S);
75
void insert_chunk(mchunkptr P, size_t S);
77
 
Line 87... Line 89...
87
#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])
89
#define mem2chunk(mem)  (mchunkptr)((char*)mem - 8)
88
#define chunk2mem(p)    (void*)((char*)p + 8)
90
#define chunk_plus_offset(p, s)  ((mchunkptr)(((char*)(p)) + (s)))
89
#define mem2chunk(mem)  (mchunkptr)((char*)mem - 8)
91
 
90
#define chunk_plus_offset(p, s)  ((mchunkptr)(((char*)(p)) + (s)))
92
 
Line -... Line 93...
-
 
93
#ifdef __cplusplus
-
 
94
}
-
 
95
#endif /* __cplusplus */
-
 
96
-
 
97
-
 
98
-
 
99