Optimizing `hasgroup`
McModknower opened this issue · comments
McModknower commented
You can optimize the hasgroup
method by getting the group id of the given name via getgrnam
once outside the loop and then just comparing the ids.
This allows you to do only minimal work in the group, optimizing your code directly by eliminating multiple calls for the group info and all calls to strcmp.