mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05: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:
parent
0f8fe3f919
commit
20ee738904
@ -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);
|
struct widget_data *widget_data = selected_widget(dlg_data);
|
||||||
int base_len = strlen(widget_data->cdata);
|
int base_len = strlen(widget_data->cdata);
|
||||||
/* Maximum number of characters in a match. Characters after this
|
/* Maximum number of characters in a match. Characters after this
|
||||||
* position are varying in other matches. Zero means that no max has
|
* position are varying in other matches. */
|
||||||
* been set yet. */
|
|
||||||
int longest_common_match = 0;
|
int longest_common_match = 0;
|
||||||
unsigned char *match = NULL;
|
unsigned char *match = NULL;
|
||||||
struct input_history_entry *entry;
|
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)
|
if (cur_len < base_len)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!match) cur_len = strlen(entry->data);
|
if (!match) {
|
||||||
|
cur_len = strlen(entry->data);
|
||||||
/* By now, @cur_len oscillates between @base_len and
|
} else if (cur_len >= longest_common_match) {
|
||||||
* @longest_common_match. */
|
/* By now, @cur_len oscillates between @base_len and
|
||||||
if (longest_common_match
|
* @longest_common_match. */
|
||||||
&& cur_len >= longest_common_match)
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* We found the next shortest common match. */
|
/* We found the next shortest common match. */
|
||||||
longest_common_match = cur_len;
|
longest_common_match = cur_len;
|
||||||
|
Loading…
Reference in New Issue
Block a user