[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

suspicious loop in Fminibuffer_complete_word

From: Kalle Olavi Niemitalo
Subject: suspicious loop in Fminibuffer_complete_word
Date: 02 May 2001 20:50:59 +0300

In GNU Emacs 20.7.2 (i386-debian-linux-gnu, X toolkit)
 of Fri Apr 13 2001 on PC486
configured using `configure  i386-debian-linux-gnu --prefix=/usr 
--sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib 
--infodir=/usr/share/info --with-pop=yes --with-x=yes --with-x-toolkit=yes'

The following loop in src/minibuf.c (Fminibuffer_complete_word)
looks suspicious:

        /* Set buffer to longest match of buffer tail and completion head.  */
        if (i <= 0) i = 1;
        start_pos= i;
        buffer_nchars -= i;
        while (i > 0)
            tem1 = Fcompare_strings (tem, make_number (start_pos), Qnil,
                                     completion, make_number (0),
                                     make_number (buffer_nchars),
                                     completion_ignore_case ? Qt : Qnil);
            if (EQ (tem1, Qt))

Why is the loop testing I>0?  I starts out as at least 1 and is
incremented all the time; it can't become <=0 unless it wraps
around.  Should the loop perhaps test BUFFER_NCHARS>0?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]