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:80715973 | yes Evaluation Count:1858432 |
evaluated: !capacity yes Evaluation Count:1304111 | yes Evaluation Count:79412388 |
| 1304111-80715973 |
36 | return !(options & Unsharable) | 1304104 |
37 | ? const_cast<QArrayData *>(&qt_array_empty) | 1304104 |
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:1304104 | 1304104 |
39 | | - |
40 | size_t headerSize = sizeof(QArrayData); | - |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
45 | | - |
46 | if (!(options & RawData)) evaluated: !(options & RawData) yes Evaluation Count:79412194 | yes Evaluation Count:1858437 |
| 1858437-79412194 |
47 | headerSize += (alignment - __alignof__(QArrayData)); executed: headerSize += (alignment - __alignof__(QArrayData)); Execution Count:79412372 | 79412372 |
48 | | - |
49 | | - |
50 | if (options & Grow) evaluated: options & Grow yes Evaluation Count:3958670 | yes Evaluation Count:77312648 |
| 3958670-77312648 |
51 | capacity = qAllocMore(objectSize * capacity, headerSize) / int(objectSize); executed: capacity = qAllocMore(objectSize * capacity, headerSize) / int(objectSize); Execution Count:3958658 | 3958658 |
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:81270407 | no Evaluation Count:0 |
| 0-81270407 |
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:81264756 | 81264756 |
66 | | - |
67 | return header; executed: return header; Execution Count:81264770 | 81264770 |
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:767412 | yes Evaluation Count:81274934 |
| 767412-81274934 |
79 | return; executed: return; Execution Count:767412 | 767412 |
80 | | - |
81 | qt_noop(); | - |
82 | ::free(data); | - |
83 | } executed: } Execution Count:81274890 | 81274890 |
84 | | - |
85 | | - |
86 | | - |
| | |