aboutsummaryrefslogtreecommitdiffstats
path: root/search.c
diff options
context:
space:
mode:
authorokan2013-03-09 21:55:56 +0000
committerokan2013-03-09 21:55:56 +0000
commitec37fa13b410764298c987ad53961c0728080b95 (patch)
tree7fb50d0ddbff4ddc97d68d52b077fb72f4aefee8 /search.c
parenta4a4ae00216838145c05fd84c5900fdc8867c99c (diff)
downloadcwm-ec37fa13b410764298c987ad53961c0728080b95.tar.gz
replace handrolled for loop with TAILQ_FOREACH; from andres.p@zoho.com
Diffstat (limited to 'search.c')
-rw-r--r--search.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/search.c b/search.c
index 9e22329..f7abb84 100644
--- a/search.c
+++ b/search.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: search.c,v 1.26 2012/11/09 03:52:02 okan Exp $
+ * $OpenBSD: search.c,v 1.27 2013/03/09 21:55:56 okan Exp $
*/
#include <sys/param.h>
@@ -223,9 +223,8 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
TAILQ_FOREACH(mi, menuq, entry) {
if (strsubmatch(search, mi->text, 1) == 0 &&
fnmatch(search, mi->text, 0) == FNM_NOMATCH)
- continue;
- for (mj = TAILQ_FIRST(resultq); mj != NULL;
- mj = TAILQ_NEXT(mj, resultentry)) {
+ continue;
+ TAILQ_FOREACH(mj, resultq, resultentry) {
if (strcasecmp(mi->text, mj->text) < 0) {
TAILQ_INSERT_BEFORE(mj, mi, resultentry);
break;