From 4aad9b7385a4c5116efba7b006f6932e0ee9bbb8 Mon Sep 17 00:00:00 2001 From: "\"Michael Hauser-Raspe\"" Date: Mon, 27 Jun 2022 19:58:04 +0100 Subject: [PATCH] Stylistic improvements. --- inc/match.h | 2 +- src/match.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/match.h b/inc/match.h index 9874b36..508c746 100644 --- a/inc/match.h +++ b/inc/match.h @@ -34,7 +34,7 @@ enum matching_mode { }; int sort_for_matching_mode(const char *text1, const char *text2, int fallback, - enum matching_mode match_type, const char *filter, bool insensitive); + enum matching_mode match_type, const char *filter, bool insensitive); bool match_for_matching_mode(const char* filter, const char* text, enum matching_mode matching, bool insensitive); #endif diff --git a/src/match.c b/src/match.c index 25a1604..3f51973 100644 --- a/src/match.c +++ b/src/match.c @@ -81,7 +81,7 @@ static bool fuzzy_match(const char* filter, const char* text, bool insensitive) } // we just check that all the characters (ignoring case) are in the // search text possibly case insensitively in the correct order - while(*filter) { + while(*filter != 0) { char nch = *filter++; if(!(text = strcasechr(text, nch, insensitive))) { @@ -229,7 +229,7 @@ static inline void match_row(int row, score_t* curr_D, score_t* curr_M, // which has been implemented here. static score_t fuzzy_score(const char* haystack, const char* needle, bool insensitive) { - if(!*needle) + if(*needle == 0) return SCORE_MIN; int n = strlen(needle);