[neomutt-devel] how does mutt determines if the debugfilename has changed?
Richard Russon
rich at flatcap.org
Wed Jun 14 18:25:15 CEST 2017
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 854 bytes
Desc: not available
URL: <http://mailman.neomutt.org/pipermail/neomutt-devel-neomutt.org/attachments/20170614/9a6a00cf/attachment.sig>
More information about the neomutt-devel
mailing list