[neomutt-devel] how does mutt determines if the debugfilename has changed?
toogley at mailbox.org
toogley at mailbox.org
Wed Jun 14 18:34:31 CEST 2017
On Wed 14 Jun 2017, 18:25:15 CEST, rich at flatcap.org wrote:
> > bool file_changed =
> > ((mutt_strlen(debugfilename) - 1) != mutt_strlen(DebugFile) ||
> > mutt_strncmp(debugfilename, DebugFile, mutt_strlen(debugfilename) - 1));
>
> > Hm.. Why don't we use mutt_strcmp() for that?
>
> When comparing: debugfilename and DebugFile we want to detect a change.
> Either the filename length has changed, or the stem (non-number part) of
> the filename has changed:
>
> Here the filename hasn't changed, but strcmp gives us the wrong answer.
>
> strcmp ('file', 'file0') => 1 /* change */
> strncmp('file', 'file0', 4) => 0 /* same */
>
> Cheers,
> Rich / FlatCap
Makes sense, thanks.
More information about the neomutt-devel
mailing list