KDE_ macros in kde_file.h

David Faure faure at kde.org
Tue Oct 10 08:54:51 BST 2006


On Tuesday 10 October 2006 00:14, Jaison Lee wrote:
> On 10/9/06, David Faure <faure at kde.org> wrote:
> > On Monday 09 October 2006 20:35, Jaison Lee wrote:
> > > Most of the KDE_* macros defined in kde_file.h (KDE_mkdir, KDE_open,
> > > KDE_rename, KDE_stat, etc.) are not used at all, and those that are
> > > are used sparingly (sometimes by only one class/function).
> >
> > They are very much used AFAICS... E.g. KDE_open is used in the following files:
> 
> 6 files out of ~1500 (in kdelibs) is "very much used" to you?  :) 
I didn't mean in terms of quantity, I meant "they are used indeed".

> KDE_rename
... is used in KSaveFile.
> KDE_sendfile
... should probably be used instead of ::sendfile in kioslave/file/file.cc
> KDE_getpos, KDE_setpos, 
> KDE_ftell, KDE_fseek
... should probably be used instead of ftell/fseek in kioslave/http/http.cc

> > Granted, some/most of those could use QFile instead, but I don't see the point;
> > don't fix it if it ain't broken as they say. KDE_foo is mostly for kdelibs itself, for
> > low-level performance-critical code. Applications can use QFile or KIO indeed.
> > We had a thread about this already iirc.
> 
> If this is indeed for kdelibs only than we should at least stop
> installing it to kde/include, or even move to a KIO only header since
> they are the only ones saying they need them. 
?? kdecore is two levels below kio, kdecore can't use a kio header.

> However, I'm wondering 
> just how much a noticeable speed improvement KDE_open is over QFile
> when you are copying over ftp. :)
Sure, kio_ftp could be ported. But how do you port C code to QFile? (fakes.c)
How do you port this to QFile?
kconfigbackend.cpp:     // We use open() to ensure that we call without O_CREAT.
kconfigbackend.cpp-     int fd = KDE_open( QFile::encodeName(filename), O_WRONLY | O_TRUNC );
KDE_open is useful for such lowlevel code, why break it?

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list