summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2022-12-29 15:57:53 +0000
committerPhilip Withnall <pwithnall@endlessos.org>2022-12-29 15:57:53 +0000
commit8463155b21df199bb46835b114bfd659bcaccc2c (patch)
tree82a4508573a68f10f79a9dde6f136e58b38329e6
parent0c640cf671c477f1ac208290c32e8fdce1280170 (diff)
downloadglib-8463155b21df199bb46835b114bfd659bcaccc2c.tar.gz
gdesktopappinfo: Drop an unnecessary NULL check
`search_token` cannot be `NULL` at this point (guaranteed by all the current call sites of `desktop_file_dir_unindexed_search()`), so remove an unnecessary `NULL` check. Add an assertion to make the nullability clear. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Coverity CID: #1502196, #1502193
-rw-r--r--gio/gdesktopappinfo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index efbbe3903..3d34e5e57 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -1253,6 +1253,8 @@ desktop_file_dir_unindexed_search (DesktopFileDir *dir,
GHashTableIter iter;
gpointer key, value;
+ g_assert (search_token != NULL);
+
if (!dir->memory_index)
desktop_file_dir_unindexed_setup_search (dir);
@@ -1270,7 +1272,7 @@ desktop_file_dir_unindexed_search (DesktopFileDir *dir,
p = strstr (key, search_token);
if (p == NULL)
continue;
- else if (p == key && search_token != NULL && *search_token != '\0')
+ else if (p == key && *search_token != '\0')
match_type = MATCH_TYPE_PREFIX;
else
match_type = MATCH_TYPE_SUBSTRING;