[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdelibs/kdecore/config
From:       David Faure <faure () kde ! org>
Date:       2008-10-16 15:28:02
Message-ID: 200810161728.03582.faure () kde ! org
[Download RAW message or body]

On Thursday 16 October 2008, Matthias Kretz wrote:
> SVN commit 872200 by mkretz:
> 
> don't pass QByteArray::constData() to a function if that object is a temporary

Why? The temporary lives until the end of the call, doesn't it?

(OK the commit saves a call to toUtf8 so it's a good idea anyway, but I'm not sure the reason was valid)

> --- trunk/KDE/kdelibs/kdecore/config/kconfig.cpp #872199:872200
> @@ -644,9 +644,10 @@
>  
>      foreach (const QByteArray& group, groups) {
>          const QStringList keys = keyList(QString::fromUtf8(group));
> -        foreach (const QString& key, keys) {
> -            if (d->canWriteEntry(group, key.toUtf8().constData())) {
> -                d->entryMap.setEntry(group, key.toUtf8(), QByteArray(), options);
> +        foreach (const QString& _key, keys) {
> +            const QByteArray &key = _key.toUtf8();
> +            if (d->canWriteEntry(group, key.constData())) {
> +                d->entryMap.setEntry(group, key, QByteArray(), options);
>                  d->bDirty = true;
>              }
>          }
> 
> 



-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic