[Kst] extragear/graphics/kst/kst/datasources/ascii
George Staikos
staikos at kde.org
Tue Aug 2 04:41:40 CEST 2005
On Friday 29 July 2005 11:44, Andrew Walker wrote:
> As I understand it the reserve method simply pre-allocates
> some space. This is really only useful if you know you're
> going to be building up a string a few characters at a time
> (resulting in many allocations). In this case we are reading
> a line of text and so only one allocation should be made, so
> we gain nothing by doing the reserve (except another call and
> most likely using more space than we actually need).
Hm, I just read the code for QFile and it looks like it won't help now:
Q_LONG QFile::readLine( QString& s, Q_ULONG maxlen )
{
QByteArray ba(maxlen);
Q_LONG l = readLine(ba.data(),maxlen);
if ( l >= 0 ) {
ba.truncate(l);
s = QString(ba);
}
return l;
}
--
George Staikos
KDE Developer http://www.kde.org/
Staikos Computing Services Inc. http://www.staikos.net/
More information about the Kst
mailing list