Commit e70871d8 authored by Hani Benhabiles's avatar Hani Benhabiles Committed by Luiz Capitulino
Browse files

readline: Make completion strings always unique



There is no need to clutter the user's choices with repeating the same value
multiple times.

Signed-off-by: default avatarHani Benhabiles <hani@linux.com>
Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
parent e3bb532c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -263,6 +263,12 @@ static void readline_hist_add(ReadLineState *rs, const char *cmdline)
void readline_add_completion(ReadLineState *rs, const char *str)
{
    if (rs->nb_completions < READLINE_MAX_COMPLETIONS) {
        int i;
        for (i = 0; i < rs->nb_completions; i++) {
            if (!strcmp(rs->completions[i], str)) {
                return;
            }
        }
        rs->completions[rs->nb_completions++] = g_strdup(str);
    }
}