On Sun, May 18, 2025 at 11:57:23PM +0800, shejialuo wrote:
The only sign compare warning in "string-list" is that we compare the
`index` of the `int` type with the `list->nr` of unsigned type. We get
index by calling "get_entry_index", which would always return unsigned
index.
Let's change the return type of "get_entry_index" to be "size_t" by
slightly modifying the binary search algorithm. Instead of letting
"left" to be "-1" initially, assign 0 to it.
It would help the reader to explain why this change is equivalent to how
it worked before.
Patrick