SpartanJ / efsw

efsw is a C++ cross-platform file system watcher and notifier.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Const reference missing on the file watcher listener

PlasmaMichael opened this issue · comments

Hi!
Just a little ticket about a missing optimization + code quality about the file watcher listener.
The actual function is:
virtual void handleFileAction(WatchID watchid, const std::string& dir, const std::string& filename, Action action, std::string oldFilename = "" ) = 0;
This part:
std::string oldFilename = ""
Should be:
const std::string& oldFilename = ""

Hi Plasma, I'm reluctant to implement this change, your observation is correct, but... this is an old minor error but I'm not sure to implement a fix since this would break the ABI and would force the devs to reimplement this method, the performance impact is insignificant for modern hardware, so it's more of a cosmetic change than anything else. For the moment I'll keep it as it is.
Thanks!