Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: fix -Wmaybe-uninitialized compiler warning
Turn the `strategy_` method pointer into an enum-based static dispatch. It's both safer and more secure (no chance of method pointer corruption) and it helps GCC see that the shift and suffix tables it's complaining about are unused in single char search mode. Fixes the following warning: ../src/string_search.h:113:30: warning: ‘search’ may be used uninitialized in this function [-Wmaybe-uninitialized] return (this->*strategy_)(subject, index); Fixes: #26733 Refs: #31532 Refs: #31798 PR-URL: #31809 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Loading branch information