[neomutt-devel] how does mutt determines if the debugfilename has changed?
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 */
Rich / FlatCap
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 854 bytes
Desc: not available
More information about the neomutt-devel