D15791: Get rid of adding 'char' to a string pointer

Rolf Eike Beer eb at emlix.com
Mon Oct 8 08:34:53 BST 2018


>   Better to use new Folder(QString(name + '/').toUtf8().conData()
>   Regards

Sadly I can't get phabricator to show me the original diff, but my initial 
thought would be something like this should be more efficient:

  (name.toUtf8() + '/').constData()

The other (entirely unrelated) question that came up when looking into the 
code is: why do the File and Folder classes use char* at all? I mean, if it 
must not be a QString for whatever reason (which one?), then use QByteArray, 
which is implicit shared, does not need manual handling in the destructor, 
does not need the extra .constData() here and so on.

Oh, and the "// undefined" comments in the header should be written as "= 
delete", then the compiler would understand them. Or should have been written 
as Q_DISABLE_COPY for ages.

Eike
-- 
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 313 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-utils-devel/attachments/20181008/b85348a8/attachment.sig>


More information about the Kde-utils-devel mailing list