Skip to content

Commit f583575

Browse files
committedMar 20, 2023
restructure header files
1 parent 6ae6c42 commit f583575

28 files changed

+60
-58
lines changed
 

‎ide/vs2022/mimalloc-override.vcxproj

+5-4
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,16 @@
209209
</PostBuildEvent>
210210
</ItemDefinitionGroup>
211211
<ItemGroup>
212-
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-internal.h" />
213212
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc.h" />
214-
<ClInclude Include="..\..\include\mimalloc-atomic.h" />
215213
<ClInclude Include="..\..\include\mimalloc-etw-gen.h" />
216214
<ClInclude Include="..\..\include\mimalloc-etw.h" />
217215
<ClInclude Include="..\..\include\mimalloc-new-delete.h" />
218216
<ClInclude Include="..\..\include\mimalloc-override.h" />
219-
<ClInclude Include="..\..\include\mimalloc-track.h" />
220-
<ClInclude Include="..\..\include\mimalloc-types.h" />
217+
<ClInclude Include="..\..\include\mimalloc\atomic.h" />
218+
<ClInclude Include="..\..\include\mimalloc\internal.h" />
219+
<ClInclude Include="..\..\include\mimalloc\prim.h" />
220+
<ClInclude Include="..\..\include\mimalloc\track.h" />
221+
<ClInclude Include="..\..\include\mimalloc\types.h" />
221222
<ClInclude Include="..\..\src\bitmap.h" />
222223
</ItemGroup>
223224
<ItemGroup>

‎ide/vs2022/mimalloc.vcxproj

+5-4
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,15 @@
241241
<ClCompile Include="..\..\src\stats.c" />
242242
</ItemGroup>
243243
<ItemGroup>
244-
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-internal.h" />
245244
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc.h" />
246-
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-atomic.h" />
247245
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-override.h" />
248-
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-types.h" />
249246
<ClInclude Include="..\..\include\mimalloc-etw.h" />
250247
<ClInclude Include="..\..\include\mimalloc-new-delete.h" />
251-
<ClInclude Include="..\..\include\mimalloc-track.h" />
248+
<ClInclude Include="..\..\include\mimalloc\atomic.h" />
249+
<ClInclude Include="..\..\include\mimalloc\internal.h" />
250+
<ClInclude Include="..\..\include\mimalloc\prim.h" />
251+
<ClInclude Include="..\..\include\mimalloc\track.h" />
252+
<ClInclude Include="..\..\include\mimalloc\types.h" />
252253
<ClInclude Include="..\..\src\bitmap.h" />
253254
</ItemGroup>
254255
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
File renamed without changes.

‎include/mimalloc-internal.h ‎include/mimalloc/internal.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ terms of the MIT license. A copy of the license can be found in the file
88
#ifndef MIMALLOC_INTERNAL_H
99
#define MIMALLOC_INTERNAL_H
1010

11-
#include "mimalloc-types.h"
12-
#include "mimalloc-track.h"
11+
#include "mimalloc/types.h"
12+
#include "mimalloc/track.h"
1313

1414
#if (MI_DEBUG>0)
1515
#define mi_trace_message(...) _mi_trace_message(__VA_ARGS__)
File renamed without changes.
File renamed without changes.

‎include/mimalloc-types.h ‎include/mimalloc/types.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ terms of the MIT license. A copy of the license can be found in the file
1010

1111
#include <stddef.h> // ptrdiff_t
1212
#include <stdint.h> // uintptr_t, uint16_t, etc
13-
#include "mimalloc-atomic.h" // _Atomic
13+
#include "mimalloc/atomic.h" // _Atomic
1414

1515
#ifdef _MSC_VER
1616
#pragma warning(disable:4214) // bitfield is not int

‎src/alloc-aligned.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ terms of the MIT license. A copy of the license can be found in the file
66
-----------------------------------------------------------------------------*/
77

88
#include "mimalloc.h"
9-
#include "mimalloc-internal.h"
10-
#include "prim/prim.h" // mi_prim_get_default_heap
9+
#include "mimalloc/internal.h"
10+
#include "mimalloc/prim.h" // mi_prim_get_default_heap
1111

1212
#include <string.h> // memset
1313

‎src/alloc-override-osx.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terms of the MIT license. A copy of the license can be found in the file
66
-----------------------------------------------------------------------------*/
77

88
#include "mimalloc.h"
9-
#include "mimalloc-internal.h"
9+
#include "mimalloc/internal.h"
1010

1111
#if defined(MI_MALLOC_OVERRIDE)
1212

‎src/alloc-posix.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ terms of the MIT license. A copy of the license can be found in the file
1010
// for convenience and used when overriding these functions.
1111
// ------------------------------------------------------------------------
1212
#include "mimalloc.h"
13-
#include "mimalloc-internal.h"
13+
#include "mimalloc/internal.h"
1414

1515
// ------------------------------------------------------
1616
// Posix & Unix functions definitions

‎src/alloc.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ terms of the MIT license. A copy of the license can be found in the file
99
#endif
1010

1111
#include "mimalloc.h"
12-
#include "mimalloc-internal.h"
13-
#include "mimalloc-atomic.h"
14-
#include "prim/prim.h" // _mi_prim_thread_id()
12+
#include "mimalloc/internal.h"
13+
#include "mimalloc/atomic.h"
14+
#include "mimalloc/prim.h" // _mi_prim_thread_id()
1515

1616
#include <string.h> // memset, strlen (for mi_strdup)
1717
#include <stdlib.h> // malloc, abort
@@ -40,7 +40,7 @@ extern inline void* _mi_page_malloc(mi_heap_t* heap, mi_page_t* page, size_t siz
4040

4141
// allow use of the block internally
4242
// note: when tracking we need to avoid ever touching the MI_PADDING since
43-
// that is tracked by valgrind etc. as non-accessible (through the red-zone, see `mimalloc-track.h`)
43+
// that is tracked by valgrind etc. as non-accessible (through the red-zone, see `mimalloc/track.h`)
4444
mi_track_mem_undefined(block, mi_page_usable_block_size(page));
4545

4646
// zero the block? note: we need to zero the full block size (issue #63)

‎src/arena.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ which is sometimes needed for embedded devices or shared memory for example.
2121
The arena allocation needs to be thread safe and we use an atomic bitmap to allocate.
2222
-----------------------------------------------------------------------------*/
2323
#include "mimalloc.h"
24-
#include "mimalloc-internal.h"
25-
#include "mimalloc-atomic.h"
24+
#include "mimalloc/internal.h"
25+
#include "mimalloc/atomic.h"
2626

2727
#include <string.h> // memset
2828
#include <errno.h> // ENOMEM

‎src/bitmap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ between the fields. (This is used in arena allocation)
1818
---------------------------------------------------------------------------- */
1919

2020
#include "mimalloc.h"
21-
#include "mimalloc-internal.h"
21+
#include "mimalloc/internal.h"
2222
#include "bitmap.h"
2323

2424
/* -----------------------------------------------------------

‎src/heap.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ terms of the MIT license. A copy of the license can be found in the file
66
-----------------------------------------------------------------------------*/
77

88
#include "mimalloc.h"
9-
#include "mimalloc-internal.h"
10-
#include "mimalloc-atomic.h"
11-
#include "mimalloc-track.h"
12-
#include "prim/prim.h" // mi_prim_get_default_heap
9+
#include "mimalloc/internal.h"
10+
#include "mimalloc/atomic.h"
11+
#include "mimalloc/prim.h" // mi_prim_get_default_heap
1312

1413
#include <string.h> // memset, memcpy
1514

‎src/init.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ terms of the MIT license. A copy of the license can be found in the file
55
"LICENSE" at the root of this distribution.
66
-----------------------------------------------------------------------------*/
77
#include "mimalloc.h"
8-
#include "mimalloc-internal.h"
9-
#include "prim/prim.h"
8+
#include "mimalloc/internal.h"
9+
#include "mimalloc/prim.h"
1010

1111
#include <string.h> // memcpy, memset
1212
#include <stdlib.h> // atexit

‎src/options.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ terms of the MIT license. A copy of the license can be found in the file
55
"LICENSE" at the root of this distribution.
66
-----------------------------------------------------------------------------*/
77
#include "mimalloc.h"
8-
#include "mimalloc-internal.h"
9-
#include "mimalloc-atomic.h"
10-
#include "prim/prim.h" // mi_prim_out_stderr
8+
#include "mimalloc/internal.h"
9+
#include "mimalloc/atomic.h"
10+
#include "mimalloc/prim.h" // mi_prim_out_stderr
1111

1212
#include <stdio.h> // FILE
1313
#include <stdlib.h> // abort

‎src/os.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ terms of the MIT license. A copy of the license can be found in the file
55
"LICENSE" at the root of this distribution.
66
-----------------------------------------------------------------------------*/
77
#include "mimalloc.h"
8-
#include "mimalloc-internal.h"
9-
#include "mimalloc-atomic.h"
10-
#include "prim/prim.h"
8+
#include "mimalloc/internal.h"
9+
#include "mimalloc/atomic.h"
10+
#include "mimalloc/prim.h"
1111

1212

1313
/* -----------------------------------------------------------

‎src/page.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ terms of the MIT license. A copy of the license can be found in the file
1212
----------------------------------------------------------- */
1313

1414
#include "mimalloc.h"
15-
#include "mimalloc-internal.h"
16-
#include "mimalloc-atomic.h"
15+
#include "mimalloc/internal.h"
16+
#include "mimalloc/atomic.h"
1717

1818
/* -----------------------------------------------------------
1919
Definition of page queues for each block size

‎src/prim/unix/prim.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ terms of the MIT license. A copy of the license can be found in the file
2121
#endif
2222

2323
#include "mimalloc.h"
24-
#include "mimalloc-internal.h"
25-
#include "mimalloc-atomic.h"
26-
#include "../prim.h"
24+
#include "mimalloc/internal.h"
25+
#include "mimalloc/atomic.h"
26+
#include "mimalloc/prim.h"
2727

2828
#include <sys/mman.h> // mmap
2929
#include <unistd.h> // sysconf

‎src/prim/wasi/prim.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ terms of the MIT license. A copy of the license can be found in the file
88
// This file is included in `src/prim/prim.c`
99

1010
#include "mimalloc.h"
11-
#include "mimalloc-internal.h"
12-
#include "mimalloc-atomic.h"
13-
#include "../prim.h"
11+
#include "mimalloc/internal.h"
12+
#include "mimalloc/atomic.h"
13+
#include "mimalloc/prim.h"
1414

1515
//---------------------------------------------
1616
// Initialize

‎src/prim/windows/prim.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ terms of the MIT license. A copy of the license can be found in the file
88
// This file is included in `src/prim/prim.c`
99

1010
#include "mimalloc.h"
11-
#include "mimalloc-internal.h"
12-
#include "mimalloc-atomic.h"
13-
#include "../prim.h"
11+
#include "mimalloc/internal.h"
12+
#include "mimalloc/atomic.h"
13+
#include "mimalloc/prim.h"
1414
#include <string.h> // strerror
1515
#include <stdio.h> // fputs, stderr
1616

@@ -157,6 +157,7 @@ void _mi_prim_mem_init( mi_os_mem_config_t* config )
157157
//---------------------------------------------
158158

159159
int _mi_prim_free(void* addr, size_t size ) {
160+
MI_UNUSED(size);
160161
DWORD errcode = 0;
161162
bool err = (VirtualFree(addr, 0, MEM_RELEASE) == 0);
162163
if (err) { errcode = GetLastError(); }

‎src/random.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ terms of the MIT license. A copy of the license can be found in the file
55
"LICENSE" at the root of this distribution.
66
-----------------------------------------------------------------------------*/
77
#include "mimalloc.h"
8-
#include "mimalloc-internal.h"
9-
#include "prim/prim.h" // _mi_prim_random_buf
8+
#include "mimalloc/internal.h"
9+
#include "mimalloc/prim.h" // _mi_prim_random_buf
1010
#include <string.h> // memset
1111

1212
/* ----------------------------------------------------------------------------

‎src/region.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Possible issues:
3232
do this better without adding too much complexity?
3333
-----------------------------------------------------------------------------*/
3434
#include "mimalloc.h"
35-
#include "mimalloc-internal.h"
36-
#include "mimalloc-atomic.h"
35+
#include "mimalloc/internal.h"
36+
#include "mimalloc/atomic.h"
3737

3838
#include <string.h> // memset
3939

‎src/segment.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ terms of the MIT license. A copy of the license can be found in the file
55
"LICENSE" at the root of this distribution.
66
-----------------------------------------------------------------------------*/
77
#include "mimalloc.h"
8-
#include "mimalloc-internal.h"
9-
#include "mimalloc-atomic.h"
8+
#include "mimalloc/internal.h"
9+
#include "mimalloc/atomic.h"
1010

1111
#include <string.h> // memset
1212
#include <stdio.h>

‎src/static.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ terms of the MIT license. A copy of the license can be found in the file
1414
#endif
1515

1616
#include "mimalloc.h"
17-
#include "mimalloc-internal.h"
17+
#include "mimalloc/internal.h"
1818

1919
// For a static override we create a single object file
2020
// containing the whole library. If it is linked first

‎src/stats.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ terms of the MIT license. A copy of the license can be found in the file
55
"LICENSE" at the root of this distribution.
66
-----------------------------------------------------------------------------*/
77
#include "mimalloc.h"
8-
#include "mimalloc-internal.h"
9-
#include "mimalloc-atomic.h"
10-
#include "prim/prim.h"
8+
#include "mimalloc/internal.h"
9+
#include "mimalloc/atomic.h"
10+
#include "mimalloc/prim.h"
1111

1212
#include <stdio.h> // snprintf
1313
#include <string.h> // memset

‎test/test-api-fill.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ terms of the MIT license. A copy of the license can be found in the file
55
"LICENSE" at the root of this distribution.
66
-----------------------------------------------------------------------------*/
77
#include "mimalloc.h"
8-
#include "mimalloc-types.h"
8+
#include "mimalloc/types.h"
99

1010
#include "testhelper.h"
1111

‎test/test-api.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ we therefore test the API over various inputs. Please add more tests :-)
3333
#endif
3434

3535
#include "mimalloc.h"
36-
// #include "mimalloc-internal.h"
37-
#include "mimalloc-types.h" // for MI_DEBUG and MI_ALIGNMENT_MAX
36+
// #include "mimalloc/internal.h"
37+
#include "mimalloc/types.h" // for MI_DEBUG and MI_ALIGNMENT_MAX
3838

3939
#include "testhelper.h"
4040

0 commit comments

Comments
 (0)