Small refactoring in cmd_search.c