[PATCH] Make KDiskFreeSpace more convenient -> KJob-like usage

Alex Merry huntedhacker at tiscali.co.uk
Thu Jul 24 19:31:50 BST 2008


On Thursday 24 July 2008 08:07:22 Sebastian TrĂ¼g wrote:
> bool KIO::freeDiskSpace( const QString& path, KIO::filesize_t* avail,
> KIO::filesize_t* size = 0 )
>
> would that be OK? And if so, should I revert the previous patch?

Personally, I think it looks odd having a function named freeDiskSpace not 
returning the data, but passing it out in pointers-to-ints.  But I'm not sure 
how to get around that, since you want to set several values at once, and 
having it return one but not the others would create a strange asymmetry.

Would splitting it into two functions (freeDiskSpace and totalDiskSpace, say) 
have a significant impact on performance?  I mean, is it worth the extra time 
cost to have a more natural API, especially as it would probably still involve 
passing a pointer to a bool to check it worked, since filesize_t is unsigned?

Other than that, I think that "size" would be better named "total" and "avail" 
should be either "available" or "free".

Alex



-- 
KDE: http://www.kde.org
Ubuntu/Kubuntu: http://www.ubuntu.org http://www.kubuntu.org





More information about the kde-core-devel mailing list