Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/global/qmalloc.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | __attribute__((visibility("default"))) void *qMalloc(size_t size) __attribute__((alloc_size(1))); | - | ||||||
6 | __attribute__((visibility("default"))) void qFree(void *ptr); | - | ||||||
7 | __attribute__((visibility("default"))) void *qRealloc(void *ptr, size_t size) __attribute__((alloc_size(2))); | - | ||||||
8 | - | |||||||
9 | - | |||||||
10 | - | |||||||
11 | void *qMalloc(size_t size) | - | ||||||
12 | { | - | ||||||
13 | return never executed: ::malloc(size);return ::malloc(size); never executed: return ::malloc(size); | 0 | ||||||
14 | } | - | ||||||
15 | - | |||||||
16 | void qFree(void *ptr) | - | ||||||
17 | { | - | ||||||
18 | ::free(ptr); | - | ||||||
19 | } never executed: end of block | 0 | ||||||
20 | - | |||||||
21 | void *qRealloc(void *ptr, size_t size) | - | ||||||
22 | { | - | ||||||
23 | return never executed: ::realloc(ptr, size);return ::realloc(ptr, size); never executed: return ::realloc(ptr, size); | 0 | ||||||
24 | } | - | ||||||
25 | - | |||||||
26 | void *qMallocAligned(size_t size, size_t alignment) | - | ||||||
27 | { | - | ||||||
28 | return executed 1462 times by 4 tests: qReallocAligned(0, size, 0, alignment);return qReallocAligned(0, size, 0, alignment); Executed by:
executed 1462 times by 4 tests: return qReallocAligned(0, size, 0, alignment); Executed by:
| 1462 | ||||||
29 | } | - | ||||||
30 | - | |||||||
31 | void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t alignment) | - | ||||||
32 | { | - | ||||||
33 | - | |||||||
34 | (void)oldsize;; | - | ||||||
35 | - | |||||||
36 | void *actualptr = oldptr
| 0-1462 | ||||||
37 | if (alignment <= sizeof(void*)
| 261-1201 | ||||||
38 | - | |||||||
39 | void **newptr = static_cast<void **>(realloc(actualptr, newsize + sizeof(void*))); | - | ||||||
40 | if (!newptr
| 0-261 | ||||||
41 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
42 | if (newptr == actualptr
| 0-261 | ||||||
43 | - | |||||||
44 | return never executed: oldptr;return oldptr; never executed: return oldptr; | 0 | ||||||
45 | } | - | ||||||
46 | - | |||||||
47 | *newptr = newptr; | - | ||||||
48 | return executed 261 times by 4 tests: newptr + 1;return newptr + 1; Executed by:
executed 261 times by 4 tests: return newptr + 1; Executed by:
| 261 | ||||||
49 | } | - | ||||||
50 | void *real = realloc(actualptr, newsize + alignment); | - | ||||||
51 | if (!real
| 0-1201 | ||||||
52 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
53 | - | |||||||
54 | quintptr faked = reinterpret_cast<quintptr>(real) + alignment; | - | ||||||
55 | faked &= ~(alignment - 1); | - | ||||||
56 | - | |||||||
57 | void **faked_ptr = reinterpret_cast<void **>(faked); | - | ||||||
58 | - | |||||||
59 | - | |||||||
60 | - | |||||||
61 | - | |||||||
62 | faked_ptr[-1] = real; | - | ||||||
63 | - | |||||||
64 | return executed 1201 times by 1 test: faked_ptr;return faked_ptr; Executed by:
executed 1201 times by 1 test: return faked_ptr; Executed by:
| 1201 | ||||||
65 | } | - | ||||||
66 | - | |||||||
67 | void qFreeAligned(void *ptr) | - | ||||||
68 | { | - | ||||||
69 | if (!ptr
| 2-1459 | ||||||
70 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||
71 | void **ptr2 = static_cast<void **>(ptr); | - | ||||||
72 | free(ptr2[-1]); | - | ||||||
73 | } executed 1459 times by 4 tests: end of block Executed by:
| 1459 | ||||||
74 | - | |||||||
75 | - | |||||||
Switch to Source code | Preprocessed file |