aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4stringobject.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-05-12 14:01:47 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-17 19:52:44 +0000
commit03598efeea1bca465df2aa5d9e2aa4e4fb4f052f (patch)
tree92ce7fbd102a159224604d4652996a3f8c43d00d /src/qml/jsruntime/qv4stringobject.cpp
parentc4854e64fe40fca164315d9251ae04af386f5adf (diff)
Minor cleanup
Narrow the scope of the match offsets counter, as suggested by the clang static code analyzer. In the second case we just wrote to the variable but never read it. Change-Id: I9e5e22bd27f892e76eccfea8b02f25795b689c36 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4stringobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 46cef39ea5..402ab420fc 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -482,12 +482,12 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
uint allocatedMatchOffsets = 64;
uint _matchOffsets[64];
uint *matchOffsets = _matchOffsets;
- uint nMatchOffsets = 0;
ScopedValue searchValue(scope, ctx->argument(0));
Scoped<RegExpObject> regExp(scope, searchValue);
if (regExp) {
uint offset = 0;
+ uint nMatchOffsets = 0;
// We extract the pointer here to work around a compiler bug on Android.
Scoped<RegExp> re(scope, regExp->value());
@@ -520,7 +520,6 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
int idx = string.indexOf(searchString);
if (idx != -1) {
numStringMatches = 1;
- nMatchOffsets = 2;
matchOffsets[0] = idx;
matchOffsets[1] = idx + searchString.length();
}