diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-07-24 22:32:38 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-04 20:16:58 +0100 |
commit | 43296bb5fb578cc64b14fb4480e6daa87bb6491d (patch) | |
tree | 6978a08c377bd1c073107496b78a2ad27036eee4 | |
parent | 6b7c3ea49c3475a71c582dd8c4a54429e543ec1c (diff) |
Remove some unneeded reinterpret_cast's
Change-Id: I29ebc1f06bb3f0d20e6e21840c7fe326a0f4546d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/jsruntime/qv4context.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4mm.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4regexp.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4regexp_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 2 |
8 files changed, 15 insertions, 15 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index 8f9f8cc423..7393041eb9 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -48,7 +48,7 @@ DEFINE_MANAGED_VTABLE(CallContext); DEFINE_MANAGED_VTABLE(WithContext); DEFINE_MANAGED_VTABLE(GlobalContext); -Returned<ExecutionContext> *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData) +Returned<CallContext> *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData) { Q_ASSERT(function->function()); @@ -78,7 +78,7 @@ Returned<ExecutionContext> *ExecutionContext::newCallContext(FunctionObject *fun std::fill(c->callData->args + c->callData->argc, c->callData->args + compiledFunction->nFormals, Primitive::undefinedValue()); c->callData->argc = qMax((uint)callData->argc, compiledFunction->nFormals); - return Returned<ExecutionContext>::create(c); + return Returned<CallContext>::create(c); } Returned<WithContext> *ExecutionContext::newWithContext(Object *with) diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 4f7cdd8105..b4c78c3736 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -127,7 +127,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed engine->current = this; } - Returned<ExecutionContext> *newCallContext(FunctionObject *f, CallData *callData); + Returned<CallContext> *newCallContext(FunctionObject *f, CallData *callData); Returned<WithContext> *newWithContext(Object *with); Returned<CatchContext> *newCatchContext(String *exceptionVarName, const ValueRef exceptionValue); Returned<CallContext> *newQmlContext(FunctionObject *f, Object *qml); diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index ea87ff1f0f..275b1c08c0 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -372,7 +372,7 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData) ExecutionContext *context = v4->currentContext(); callData->thisObject = obj.asReturnedValue(); - ExecutionContext *ctx = reinterpret_cast<ExecutionContext *>(context->newCallContext(f.getPointer(), callData)); + Scoped<CallContext> ctx(scope, context->newCallContext(f.getPointer(), callData)); ExecutionContextSaver ctxSaver(context); ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function())); @@ -399,7 +399,7 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData) ExecutionContext *context = v4->currentContext(); Scope scope(context); - CallContext *ctx = reinterpret_cast<CallContext *>(context->newCallContext(f, callData)); + Scoped<CallContext> ctx(scope, context->newCallContext(f, callData)); ExecutionContextSaver ctxSaver(context); ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function())); diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp index 3877dde251..8174fa93ec 100644 --- a/src/qml/jsruntime/qv4mm.cpp +++ b/src/qml/jsruntime/qv4mm.cpp @@ -492,9 +492,9 @@ size_t MemoryManager::getUsedMem() const char *chunkStart = reinterpret_cast<char *>(i->memory.base()); char *chunkEnd = chunkStart + i->memory.size() - i->chunkSize; for (char *chunk = chunkStart; chunk <= chunkEnd; chunk += i->chunkSize) { - Managed *m = reinterpret_cast<Managed *>(chunk); + Managed::Data *m = reinterpret_cast<Managed::Data *>(chunk); Q_ASSERT((qintptr) chunk % 16 == 0); - if (m->inUse()) + if (m->inUse) usedMem += i->chunkSize; } } diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp index ed672892c2..4c33424f0b 100644 --- a/src/qml/jsruntime/qv4regexp.cpp +++ b/src/qml/jsruntime/qv4regexp.cpp @@ -63,14 +63,14 @@ uint RegExp::match(const QString &string, int start, uint *matchOffsets) return JSC::Yarr::interpret(byteCode().get(), s.characters16(), string.length(), start, matchOffsets); } -RegExp* RegExp::create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline) +Returned<RegExp> *RegExp::create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline) { RegExpCacheKey key(pattern, ignoreCase, multiline); RegExpCache *cache = engine->regExpCache; if (cache) { if (RegExp *result = cache->value(key)) - return result; + return Returned<RegExp>::create(result); } Scope scope(engine); @@ -82,7 +82,7 @@ RegExp* RegExp::create(ExecutionEngine* engine, const QString& pattern, bool ign result->d()->cache = cache; cache->insert(key, result); - return result; + return result.asReturned(); } RegExp::Data::Data(ExecutionEngine* engine, const QString &pattern, bool ignoreCase, bool multiline) diff --git a/src/qml/jsruntime/qv4regexp_p.h b/src/qml/jsruntime/qv4regexp_p.h index e2f43bf7d7..a46dd980f9 100644 --- a/src/qml/jsruntime/qv4regexp_p.h +++ b/src/qml/jsruntime/qv4regexp_p.h @@ -85,7 +85,7 @@ struct RegExp : public Managed bool ignoreCase() const { return d()->ignoreCase; } bool multiLine() const { return d()->multiLine; } - static RegExp* create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase = false, bool multiline = false); + static Returned<RegExp> *create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase = false, bool multiline = false); bool isValid() const { return d()->byteCode.get(); } diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index c48175247e..f1771782d7 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -71,7 +71,7 @@ RegExpObject::Data::Data(InternalClass *ic) Scope scope(ic->engine); Scoped<RegExpObject> o(scope, this); - o->d()->value = reinterpret_cast<RegExp *>(RegExp::create(ic->engine, QString(), false, false)); + o->d()->value = RegExp::create(ic->engine, QString(), false, false)->getPointer(); o->d()->global = false; o->init(ic->engine); } @@ -139,7 +139,7 @@ RegExpObject::Data::Data(ExecutionEngine *engine, const QRegExp &re) Scope scope(engine); Scoped<RegExpObject> o(scope, this); - o->d()->value = reinterpret_cast<RegExp *>(RegExp::create(engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false)); + o->d()->value = RegExp::create(engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false)->getPointer(); o->init(engine); } @@ -286,7 +286,7 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData) } } - RegExp *regexp = reinterpret_cast<RegExp *>(RegExp::create(ctx->d()->engine, pattern, ignoreCase, multiLine)); + Scoped<RegExp> regexp(scope, RegExp::create(ctx->d()->engine, pattern, ignoreCase, multiLine)); if (!regexp->isValid()) return ctx->throwSyntaxError(QStringLiteral("Invalid regular expression")); diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index e87a900267..2180fbc248 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -549,7 +549,7 @@ struct ValueRef { ReturnedValue asReturnedValue() const { return ptr->val; } // ### get rid of this one! - ValueRef(Value *v) { ptr = reinterpret_cast<Value *>(v); } + ValueRef(Value *v) { ptr = v; } private: Value *ptr; }; |