1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00

Stop using a special value of 0 for longest_common_match to check whether

a match has been found and just check whether match is NULL.
This commit is contained in:
Miciah Dashiel Butler Masters 2005-12-16 23:37:52 +00:00 committed by Miciah Dashiel Butler Masters
parent 0f8fe3f919
commit 20ee738904

View File

@ -109,8 +109,7 @@ do_tab_compl_unambiguous(struct dialog_data *dlg_data, struct list_head *history
struct widget_data *widget_data = selected_widget(dlg_data);
int base_len = strlen(widget_data->cdata);
/* Maximum number of characters in a match. Characters after this
* position are varying in other matches. Zero means that no max has
* been set yet. */
* position are varying in other matches. */
int longest_common_match = 0;
unsigned char *match = NULL;
struct input_history_entry *entry;
@ -123,13 +122,13 @@ do_tab_compl_unambiguous(struct dialog_data *dlg_data, struct list_head *history
if (cur_len < base_len)
continue;
if (!match) cur_len = strlen(entry->data);
/* By now, @cur_len oscillates between @base_len and
* @longest_common_match. */
if (longest_common_match
&& cur_len >= longest_common_match)
if (!match) {
cur_len = strlen(entry->data);
} else if (cur_len >= longest_common_match) {
/* By now, @cur_len oscillates between @base_len and
* @longest_common_match. */
continue;
}
/* We found the next shortest common match. */
longest_common_match = cur_len;