summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c195305)
raw | patch | inline | side by side (parent: c195305)
author | Max Kellermann <max@duempel.org> | |
Sat, 10 Oct 2009 15:45:57 +0000 (17:45 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sat, 10 Oct 2009 15:45:57 +0000 (17:45 +0200) |
Added an assertion, removed two runtime checks. Same for
list_window_find() and list_window_rfind().
list_window_find() and list_window_rfind().
src/list_window.c | patch | blob | history |
diff --git a/src/list_window.c b/src/list_window.c
index bda9f30a64954528e87cc7ca946abcaa55a61d52..f3251d3ceaf9657292aa5bf56b817202cf22324f 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
unsigned i = lw->selected + 1;
const char *label;
+ assert(str != NULL);
+
do {
while (i < lw->length) {
label = callback(i, &h, NULL, callback_data);
assert(label != NULL);
- if (str && label && match_line(label, str)) {
+ if (match_line(label, str)) {
list_window_move_cursor(lw, i);
return true;
}
int i = lw->selected - 1;
const char *label;
+ assert(str != NULL);
+
if (lw->length == 0)
return false;
label = callback(i, &h, NULL, callback_data);
assert(label != NULL);
- if( str && label && match_line(label, str) ) {
+ if (match_line(label, str)) {
list_window_move_cursor(lw, i);
return true;
}
bool h;
const char *label;
+ assert(str != NULL);
+
for (unsigned i = 0; i < lw->length; ++i) {
label = callback(i, &h, NULL, callback_data);
assert(label != NULL);
if (label[0] == '[')
label++;
#ifndef NCMPC_MINI
- if (str && label &&
- ((options.jump_prefix_only && g_ascii_strncasecmp(label, str, strlen(str)) == 0) ||
- (!options.jump_prefix_only && match_line(label, str))) )
+ if ((options.jump_prefix_only && g_ascii_strncasecmp(label, str, strlen(str)) == 0) ||
+ (!options.jump_prefix_only && match_line(label, str)))
#else
- if (str && label && g_ascii_strncasecmp(label, str, strlen(str)) == 0)
+ if (g_ascii_strncasecmp(label, str, strlen(str)) == 0)
#endif
{
list_window_move_cursor(lw, i);