[neomutt-devel] how does mutt determines if the debugfilename has changed?
rich at flatcap.org
Wed Jun 14 10:27:48 CEST 2017
> bool file_changed =
> ((mutt_strlen(debugfilename) - 1) != mutt_strlen(DebugFile) ||
> mutt_strncmp(debugfilename, DebugFile, mutt_strlen(debugfilename) - 1));
> * I don't understand why the length of debugfilename *minus 1* is
> compared to the one from DebugFile. Shouldn't both use the original
DebugFile is the stem of the filename. It will have a digit appended.
DebugFile = mylog
actual files: mylog0 mylog1 ...
> * I don't understand why the length comparison is needed at all.
> because, when two strings have the same characters, they would also
> have the same length.
It's to prevent short comparisons. If we were comparing the whole
strings, it wouldn't be necessary.
We have to take the length of one of the strings for strncmp.
What we don't want, is to say: "the strings match", when what we
actually have is:
strncmp("red", "redder", 3)
Rich / FlatCap
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 854 bytes
Desc: not available
More information about the neomutt-devel