events: extract listener check as a function
As there are multiple funcions checking the argument listener
,so extract listener
check as a separate function.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines