Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | const QArrayData QArrayData::shared_null[2] = { | - |
12 | { { { (-1) } }, 0, 0, 0, sizeof(QArrayData) }, | - |
13 | }; | - |
14 | | - |
15 | static const QArrayData qt_array[3] = { | - |
16 | { { { (-1) } }, 0, 0, 0, sizeof(QArrayData) }, | - |
17 | { { { (0) } }, 0, 0, 0, sizeof(QArrayData) }, | - |
18 | }; | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | static const QArrayData &qt_array_empty = qt_array[0]; | - |
25 | static const QArrayData &qt_array_unsharable_empty = qt_array[1]; | - |
26 | | - |
27 | QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment, | - |
28 | size_t capacity, AllocationOptions options) | - |
29 | { | - |
30 | | - |
31 | qt_noop(); | - |
32 | | - |
33 | | - |
34 | | - |
35 | if (!(options & RawData) && !capacity) evaluated: !(options & RawData) yes Evaluation Count:146977606 | yes Evaluation Count:1924613 |
evaluated: !capacity yes Evaluation Count:4421489 | yes Evaluation Count:142555472 |
| 1924613-146977606 |
36 | return !(options & Unsharable) | 4421484 |
37 | ? const_cast<QArrayData *>(&qt_array_empty) | 4421484 |
38 | : const_cast<QArrayData *>(&qt_array_unsharable_empty); executed: return !(options & Unsharable) ? const_cast<QArrayData *>(&qt_array_empty) : const_cast<QArrayData *>(&qt_array_unsharable_empty); Execution Count:4421484 | 4421484 |
39 | | - |
40 | size_t headerSize = sizeof(QArrayData); | - |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
45 | | - |
46 | if (!(options & RawData)) evaluated: !(options & RawData) yes Evaluation Count:142556160 | yes Evaluation Count:1924622 |
| 1924622-142556160 |
47 | headerSize += (alignment - __alignof__(QArrayData)); executed: headerSize += (alignment - __alignof__(QArrayData)); Execution Count:142556289 | 142556289 |
48 | | - |
49 | | - |
50 | if (options & Grow) evaluated: options & Grow yes Evaluation Count:11793134 | yes Evaluation Count:132688185 |
| 11793134-132688185 |
51 | capacity = qAllocMore(objectSize * capacity, headerSize) / int(objectSize); executed: capacity = qAllocMore(objectSize * capacity, headerSize) / int(objectSize); Execution Count:11793118 | 11793118 |
52 | | - |
53 | size_t allocSize = headerSize + objectSize * capacity; | - |
54 | | - |
55 | QArrayData *header = static_cast<QArrayData *>(::malloc(allocSize)); | - |
56 | if (header) { partially evaluated: header yes Evaluation Count:144481966 | no Evaluation Count:0 |
| 0-144481966 |
57 | quintptr data = (quintptr(header) + sizeof(QArrayData) + alignment - 1) | - |
58 | & ~(alignment - 1); | - |
59 | | - |
60 | header->ref.atomic.store(bool(!(options & Unsharable))); | - |
61 | header->size = 0; | - |
62 | header->alloc = capacity; | - |
63 | header->capacityReserved = bool(options & CapacityReserved); | - |
64 | header->offset = data - quintptr(header); | - |
65 | } executed: } Execution Count:144478879 | 144478879 |
66 | | - |
67 | return header; executed: return header; Execution Count:144478960 | 144478960 |
68 | } | - |
69 | | - |
70 | void QArrayData::deallocate(QArrayData *data, size_t objectSize, | - |
71 | size_t alignment) | - |
72 | { | - |
73 | | - |
74 | qt_noop(); | - |
75 | | - |
76 | (void)objectSize; (void)alignment; | - |
77 | | - |
78 | if (data == &qt_array_unsharable_empty) evaluated: data == &qt_array_unsharable_empty yes Evaluation Count:3528968 | yes Evaluation Count:144517736 |
| 3528968-144517736 |
79 | return; executed: return; Execution Count:3528970 | 3528970 |
80 | | - |
81 | qt_noop(); | - |
82 | ::free(data); | - |
83 | } executed: } Execution Count:144517383 | 144517383 |
84 | | - |
85 | | - |
86 | | - |
| | |