diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-10-15 02:04:05 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-10-15 02:04:05 +0200 |
commit | 33b75336e5148b7dcf6113dcfe59d58ee38f9481 (patch) | |
tree | f98b0fe55d4e798a450d069b15a3d5056fa999d4 /libqmenumodel/src | |
parent | 462b8422fd363d6ef3b6882459926a87ca389fe0 (diff) | |
download | qmenumodel-33b75336e5148b7dcf6113dcfe59d58ee38f9481.tar.gz qmenumodel-33b75336e5148b7dcf6113dcfe59d58ee38f9481.tar.bz2 qmenumodel-33b75336e5148b7dcf6113dcfe59d58ee38f9481.zip |
UnityMenuModel: avoid initializing an empty QVariant if not needed
Diffstat (limited to 'libqmenumodel/src')
-rw-r--r-- | libqmenumodel/src/unitymenumodel.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index a407ac1..4c238d8 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -717,12 +717,11 @@ void UnityMenuModel::activate(int index, const QVariant& parameter) static QVariant parseVariantString(const QString& string) { - QVariant qvariant; GVariant *gvariant; GError *error = NULL; if (string.isEmpty()) { - return qvariant; + return QVariant(); } gvariant = g_variant_parse (NULL, string.toUtf8().data(), NULL, NULL, &error); @@ -730,10 +729,10 @@ static QVariant parseVariantString(const QString& string) if (error) { qWarning() << "Impossible to parse" << string << "as variant string:"<< error->message; g_error_free (error); - return qvariant; + return QVariant(); } - qvariant = Converter::toQVariant(gvariant); + const QVariant& qvariant = Converter::toQVariant(gvariant); g_variant_unref (gvariant); return qvariant; |