async_hooks: add copyHooks function
This commit introduces a copyHooks function that can be used by storeActiveHooks and restoreActiveHooks to remove some code duplication.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines