> On Jan. 11, 2016, 12:38 a.m., Joris Van Remoortere wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/ls.hpp, lines > > 36-42 > > <https://reviews.apache.org/r/39802/diff/3/?file=1128786#file1128786line36> > > > > If this is the only section that is different between the POSIX and > > windows version, does it make sense to factor out this size calculation, > > and leave a common `ls` implementation? > > Alex Clemmer wrote: > It might. Lets look at a couple ways of doing this: > > * Since the main problem is `fpathconf` (which doesn't make much sense on > Windows), we could create a new function, `os::fpathconf` that simply always > returns `-1`. > * We could create some other function whose job is just to give the size > of the `dirent` struct on a particular platform. But, I don't know what to > call it, or where to put it. > * Just keep the forked version. > > I'm not sure if any of these really reaches out to you. For me, I liked > the last one because I felt it was clearest on both platforms. For example, > the `os::fpathconf` approach will be a lot less clear because it won't be > obvious to _anyone_ that we're just returning -1 all the time, or what the > consequences is for the reported dirent struct size on Windows. The forked > dirent-size-function is not elegant, and adds API bloat, and still requires a > forked file, albeit a much smaller one. > > I don't know, I'm open to other opinions. I think they all have serious > downsides. My second choice is the forked dirent-size-function option, > because it doesn't sacrifice code readability.
How about `os::dirent_size`? - Joris ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/39802/#review113580 ----------------------------------------------------------- On Jan. 11, 2016, 11:59 a.m., Alex Clemmer wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/39802/ > ----------------------------------------------------------- > > (Updated Jan. 11, 2016, 11:59 a.m.) > > > Review request for mesos, Artem Harutyunyan, Joris Van Remoortere, and Joseph > Wu. > > > Repository: mesos > > > Description > ------- > > Windows: Implemented `stout/os/windows/ls.hpp`. > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/ls.hpp > fcc6986f1b6355e0f0f7e25a6e428ab878a97ee4 > 3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/ls.hpp > 5b41344ead115d14dcee8c87a63ed647002f9aae > > Diff: https://reviews.apache.org/r/39802/diff/ > > > Testing > ------- > > > Thanks, > > Alex Clemmer > >