Add -fno-strict-aliasing to prevent compile warnings on some systems.
[polipo.git] / chunk.h
blob78d974353e9130c16c82467ed391980876476502
1 /*
2 Copyright (c) 2003-2006 by Juliusz Chroboczek
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
23 /* A larger chunk size gets you better I/O throughput, at the cost of
24 higer memory usage. We assume you've got plenty of memory if you've
25 got 64-bit longs. */
27 #ifndef CHUNK_SIZE
28 #ifdef ULONG_MAX
29 #if ULONG_MAX > 4294967295UL
30 #define CHUNK_SIZE (8 * 1024)
31 #else
32 #define CHUNK_SIZE (4 * 1024)
33 #endif
34 #else
35 #define CHUNK_SIZE (4 * 1024)
36 #endif
37 #endif
39 #define CHUNKS(bytes) ((unsigned long)(bytes) / CHUNK_SIZE)
41 extern int chunkLowMark, chunkHighMark, chunkCriticalMark;
42 extern int used_chunks;
44 void preinitChunks(void);
45 void initChunks(void);
46 void *get_chunk(void) ATTRIBUTE ((malloc));
47 void *maybe_get_chunk(void) ATTRIBUTE ((malloc));
49 void dispose_chunk(void *chunk);
50 void free_chunk_arenas(void);
51 int totalChunkArenaSize(void);