mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
notmuch_query_search_threads: Avoid returning more threads than asked for.
I thought it would be safe enough to return a few extra threads, (since we happened to already get the relevant messages out of the database). The problem is that then requires the caller to carefully read the number of threads returned and adjust its next "first" value accordingly. The interface is much simpler to use if we simply return exactly what is asked for and no more.
This commit is contained in:
parent
e4a7c2b870
commit
bbf4b8e4ae
1 changed files with 3 additions and 0 deletions
|
@ -237,6 +237,9 @@ notmuch_query_search_threads (notmuch_query_t *query,
|
||||||
notmuch_message_destroy (message);
|
notmuch_message_destroy (message);
|
||||||
|
|
||||||
messages_seen++;
|
messages_seen++;
|
||||||
|
|
||||||
|
if (max_threads >= 0 && threads_seen >= first + max_threads)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop if we're not seeing any more messages. */
|
/* Stop if we're not seeing any more messages. */
|
||||||
|
|
Loading…
Reference in a new issue