forked from qt-creator/qt-creator
Revert "Reduce allocations patches"
This reverts commit4580a3b222. This reverts commite852173484. We still have to support old gcc. (🍒 picked from commit e9c6944479fad2288060c72bb4df8dcbab9e0b2c) Change-Id: Ia8b198390a0f82c2104991900a3091c96d6e7f24 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -29,8 +29,6 @@
|
|||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <charconv>
|
|
||||||
|
|
||||||
|
|
||||||
using namespace LanguageUtils;
|
using namespace LanguageUtils;
|
||||||
|
|
||||||
@@ -75,12 +73,12 @@ bool ComponentVersion::isValid() const
|
|||||||
|
|
||||||
QString ComponentVersion::toString() const
|
QString ComponentVersion::toString() const
|
||||||
{
|
{
|
||||||
char text[std::numeric_limits<int>::digits10 * 2 + 1];
|
QByteArray temp;
|
||||||
auto [majorEnd, majorError] = std::to_chars(std::begin(text), std::end(text), _major);
|
QByteArray result;
|
||||||
*majorEnd = '.';
|
result += temp.setNum(_major);
|
||||||
++majorEnd;
|
result += '.';
|
||||||
auto [minorEnd, minorError] = std::to_chars(majorEnd, std::end(text), _minor);
|
result += temp.setNum(_minor);
|
||||||
return QLatin1String(std::data(text), static_cast<int>(minorEnd - std::begin(text)));
|
return QString::fromLatin1(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentVersion::addToHash(QCryptographicHash &hash) const
|
void ComponentVersion::addToHash(QCryptographicHash &hash) const
|
||||||
|
|||||||
@@ -44,9 +44,6 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <charconv>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -714,22 +711,9 @@ PropertyName NodeMetaInfoPrivate::defaultPropertyName() const
|
|||||||
return PropertyName("data");
|
return PropertyName("data");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addNumber(TypeName &id, int number)
|
static inline TypeName stringIdentifier( const TypeName &type, int maj, int min)
|
||||||
{
|
{
|
||||||
char text[std::numeric_limits<int>::digits10 + 1];
|
return type + QByteArray::number(maj) + '_' + QByteArray::number(min);
|
||||||
auto [end, error] = std::to_chars(std::begin(text), std::end(text), number);
|
|
||||||
id.append(std::data(text), static_cast<int>(end - std::begin(text)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static TypeName stringIdentifier(const TypeName &type, int majorVersion, int minorVersion)
|
|
||||||
{
|
|
||||||
TypeName id = type;
|
|
||||||
id.reserve(id.size() + 5);
|
|
||||||
addNumber(id, majorVersion);
|
|
||||||
id.append('_');
|
|
||||||
addNumber(id, minorVersion);
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeMetaInfoPrivate::Pointer NodeMetaInfoPrivate::create(Model *model, const TypeName &type, int major, int minor)
|
NodeMetaInfoPrivate::Pointer NodeMetaInfoPrivate::create(Model *model, const TypeName &type, int major, int minor)
|
||||||
|
|||||||
Reference in New Issue
Block a user