D20096: [WIP/help wanted] Fill UDSEntry::UDS_CREATION_TIME under linux when glibc >= 2.28

Stefan Brüns noreply at phabricator.kde.org
Sat Mar 30 17:51:39 GMT 2019


bruns added a comment.


  In D20096#440470 <https://phabricator.kde.org/D20096#440470>, @meven wrote:
  
  > In D20096#440443 <https://phabricator.kde.org/D20096#440443>, @bruns wrote:
  >
  > > I think the regular stat and statx implementations should be merged. This requires a little bit of refactoring, but avoids a lot of code duplication.
  >
  >
  > I thought about it, but the two structs have quite some differences, so it would require to introduce an intermediary stat struct, which is fine for me.
  >  And then introduce a STAT like macro to wrap either calling statx or QL_STAT and mixing and matching stat/statx into the new struct.
  >
  > Do you agree with this course ?
  
  
  You can use trivial inline accessors:
  
    #if HAVE_STATX_BTIME
    static int stat_mode(struct statx buf) { return buf.stx_mode; }
    static int stat_uid(struct statx buf) { return buf.stx_uid; }
    ...
    #else
    static int stat_mode(struct stat buf) { return buf.st_mode; }
    static int stat_uid(struct stat buf) { return buf.st_uid; }
    ...
  
  Better avoid macros and use typesave code
  
  As there are just 2 calls to stat/statx, just use #if/#else. Maybe
  
    #if
    struct statx buff;
    bool statOk = statx(...) == 0;
    #else
    struct stat buff;
    bool statOk = stat(...) == 0;
    #endif
    
    if (statOk) {
    ...

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D20096

To: meven, #frameworks, dfaure, fvogt, bruns, broulik
Cc: ngraham, kde-frameworks-devel, michaelh, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190330/bf27e51c/attachment.html>


More information about the Kde-frameworks-devel mailing list