summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2024-01-31 13:44:23 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2024-01-31 21:18:48 +0100
commit43f66e619176e4903aa62a30dc5ae2122e22f13a (patch)
treea6cb7ffc14e1f57f4d20606583d0b79e727be103 /src/corelib/kernel
parent76cf922980cf0cde7cb03f4bec8f17eab94a5767 (diff)
JNI: pass POD parameters by value
All calls to the fromVarArg() conversion helper are made with JNI types from a va_arg list, so they have to be either primitive types, or a pointer (jobject, which internally is a _jobject *). There's no benefit from moving those or passing them by reference; the most efficient convention is to pass them by value. Pick-to: 6.7 Change-Id: I6fed9b202be3c6a265117684fecd51d03ccbb534 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qjnitypes.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/kernel/qjnitypes.h b/src/corelib/kernel/qjnitypes.h
index 71c4db670c..978b0f0e8f 100644
--- a/src/corelib/kernel/qjnitypes.h
+++ b/src/corelib/kernel/qjnitypes.h
@@ -78,7 +78,7 @@ struct JNITypeForArgImpl
using Type = std::conditional_t<std::disjunction_v<std::is_base_of<QJniObject, Arg>,
std::is_base_of<QtJniTypes::JObjectBase, Arg>>,
jobject, typename PromotedType<Arg>::Type>;
- static Arg fromVarArg(Type &&t)
+ static Arg fromVarArg(Type t)
{
return static_cast<Arg>(t);
}
@@ -89,7 +89,7 @@ struct JNITypeForArgImpl<QString>
{
using Type = jstring;
- static QString fromVarArg(Type &&t)
+ static QString fromVarArg(Type t)
{
return QJniObject(t).toString();
}
@@ -98,9 +98,9 @@ struct JNITypeForArgImpl<QString>
template <typename Arg>
using JNITypeForArg = typename JNITypeForArgImpl<std::decay_t<Arg>>::Type;
template <typename Arg, typename Type>
-static inline auto methodArgFromVarArg(Type &&t)
+static inline auto methodArgFromVarArg(Type t) // Type comes from a va_arg, so is always POD
{
- return JNITypeForArgImpl<std::decay_t<Arg>>::fromVarArg(std::move(t));
+ return JNITypeForArgImpl<std::decay_t<Arg>>::fromVarArg(t);
}
// Turn a va_list into a tuple of typed arguments