On Tue, Apr 26, 2022 at 2:24 PM Povilas Kanapickas <[email protected]> wrote: > > Hi, > > On 2022-04-26 17:11, James Ring wrote: > > Hi all, > > > > Would there be any objection if I did some work on tidying up the > > scanimage frontend implementation? Currently, there are some deeply > > nested parts of the scanning code interspersed with ifdefs that make > > it pretty hard to follow. > > Agreed, any such improvements are welcome. > > > More controversial question, what about writing some parts of it in > > C++? Applied judiciously, it could make the code easier to maintain. > > My plan would be to use a small subset of C++ (no exceptions, for > > example). > > That would be great. > > I suggest to start with the C++ migration first, because it's easy to > introduce leaks and similar problems when refactoring C code. > > Also, I suggest to split the changes into as many commits as reasonably > possible. Large refactoring is likely to introduce regressions. When > there are many commits it's possible to quickly bisect the problem. > Having 10 line change in front of the eyes and knowledge that the source > of the problem is exactly there makes it much easier to quickly address > issues.
Thank you both for the enthusiasm. My plan would be to first add some regression tests to minimize the chance that I break existing users, then start working on the actual frontend code. I found small things, like introducing RAII to auto-sane-close() device handles, very handy. I'm sensitive to how many platforms SANE tries to support, so I will use vanilla C++ as much as possible and not introduce external dependencies. > Cheers, > Povilas Thanks, James
