Commit 6315bd5d authored by Marco Bubke's avatar Marco Bubke

Utils: Rename hasAllocated in isReference

HasAllocated it misleading because it means that it has read only
references too. Maybe isPointing would be good too but so it is more
orthogonal to isReadOnlyReference.

Change-Id: I79aaa271aa302de2500c2ea81614e433d76f74ec
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent e562af2c
......@@ -95,7 +95,7 @@ public:
std::memcpy(m_data.shortString.string, string, size);
m_data.shortString.string[size] = 0;
m_data.shortString.shortStringSize = uchar(size);
m_data.shortString.hasAllocated = false;
m_data.shortString.isReference = false;
m_data.shortString.isReadOnlyReference = false;
} else {
m_data.allocated.data.pointer = Memory::allocate(capacity + 1);
......@@ -104,7 +104,7 @@ public:
m_data.allocated.data.size = size;
m_data.allocated.data.capacity = capacity;
m_data.allocated.shortStringSize = 0;
m_data.allocated.hasAllocated = true;
m_data.allocated.isReference = true;
m_data.allocated.isReadOnlyReference = false;
}
}
......@@ -470,7 +470,7 @@ public:
UNIT_TEST_PUBLIC:
bool isShortString() const noexcept
{
return !m_data.shortString.hasAllocated;
return !m_data.shortString.isReference;
}
bool isReadOnlyReference() const noexcept
......
......@@ -63,7 +63,7 @@ struct AllocatedLayout {
char dummy[maximumShortStringDataAreaSize - sizeof(Data)];
std::uint8_t shortStringSize: 6;
std::uint8_t isReadOnlyReference : 1;
std::uint8_t hasAllocated : 1;
std::uint8_t isReference : 1;
};
struct ReferenceLayout {
......@@ -75,14 +75,14 @@ struct ReferenceLayout {
char dummy[maximumShortStringDataAreaSize - sizeof(Data)];
std::uint8_t shortStringSize: 6;
std::uint8_t isReadOnlyReference : 1;
std::uint8_t hasAllocated : 1;
std::uint8_t isReference : 1;
};
struct ShortStringLayout {
char string[maximumShortStringDataAreaSize];
std::uint8_t shortStringSize: 6;
std::uint8_t isReadOnlyReference : 1;
std::uint8_t hasAllocated : 1;
std::uint8_t isReference : 1;
};
struct ALIGNAS_16 StringDataLayout {
......@@ -111,14 +111,14 @@ struct ALIGNAS_16 StringDataLayout {
shortString.shortStringSize = std::uint8_t(Size) - 1;
#pragma GCC diagnostic pop
#endif
shortString.hasAllocated = false;
shortString.isReference = false;
shortString.isReadOnlyReference = false;
} else {
reference.data.pointer = string;
reference.data.size = Size - 1;
reference.data.capacity = 0;
reference.shortStringSize = 0;
reference.hasAllocated = true;
reference.isReference = true;
reference.isReadOnlyReference = true;
}
#endif
......
......@@ -107,7 +107,7 @@ public:
constexpr
bool isShortString() const noexcept
{
return !m_data.shortString.hasAllocated;
return !m_data.shortString.isReference;
}
constexpr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment