aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/util
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 11:52:59 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 13:08:30 +0000
commit06e962f263a86c4b66e1c6195b3d2615695fea1e (patch)
tree3669793f9983762538a9cb12a07ce49d461f066d /src/qml/util
parent78e875e6dbd4991fe22c194d8608b3d66c96e036 (diff)
init variables where they are declared when possible (clang-tidy)
clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/qml/util')
-rw-r--r--src/qml/util/qqmlchangeset_p.h6
-rw-r--r--src/qml/util/qqmllistcompositor_p.h21
2 files changed, 13 insertions, 14 deletions
diff --git a/src/qml/util/qqmlchangeset_p.h b/src/qml/util/qqmlchangeset_p.h
index 8bc13f1b67..8347a3ff19 100644
--- a/src/qml/util/qqmlchangeset_p.h
+++ b/src/qml/util/qqmlchangeset_p.h
@@ -62,10 +62,10 @@ class Q_QML_PRIVATE_EXPORT QQmlChangeSet
public:
struct MoveKey
{
- MoveKey() : moveId(-1), offset(0) {}
+ MoveKey() {}
MoveKey(int moveId, int offset) : moveId(moveId), offset(offset) {}
- int moveId;
- int offset;
+ int moveId = -1;
+ int offset = 0;
};
// The storrage for Change (below). This struct is trivial, which it has to be in order to store
diff --git a/src/qml/util/qqmllistcompositor_p.h b/src/qml/util/qqmllistcompositor_p.h
index d5723889e1..172040559c 100644
--- a/src/qml/util/qqmllistcompositor_p.h
+++ b/src/qml/util/qqmllistcompositor_p.h
@@ -87,17 +87,17 @@ public:
class Range
{
public:
- Range() : next(this), previous(this), list(nullptr), index(0), count(0), flags(0) {}
+ Range() : next(this), previous(this) {}
Range(Range *next, void *list, int index, int count, uint flags)
: next(next), previous(next->previous), list(list), index(index), count(count), flags(flags) {
next->previous = this; previous->next = this; }
Range *next;
Range *previous;
- void *list;
- int index;
- int count;
- uint flags;
+ void *list = nullptr;
+ int index = 0;
+ int count = 0;
+ uint flags = 0;
inline int start() const { return index; }
inline int end() const { return index + count; }
@@ -145,11 +145,11 @@ public:
void setGroup(Group g) { group = g; groupFlag = 1 << g; }
- Range *range;
- int offset;
- Group group;
+ Range *range = nullptr;
+ int offset = 0;
+ Group group = Default;
int groupFlag;
- int groupCount;
+ int groupCount = 0;
union {
struct {
int cacheIndex;
@@ -308,8 +308,7 @@ Q_DECLARE_TYPEINFO(QQmlListCompositor::Change, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QQmlListCompositor::Remove, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QQmlListCompositor::Insert, Q_PRIMITIVE_TYPE);
-inline QQmlListCompositor::iterator::iterator()
- : range(nullptr), offset(0), group(Default), groupCount(0) {}
+inline QQmlListCompositor::iterator::iterator() {}
inline QQmlListCompositor::iterator::iterator(const iterator &it)
: range(it.range)
, offset(it.offset)