Re: [PATCH v2 4/8] string-list: enable sign compare warnings check
On Mon, May 19, 2025 at 09:18:03AM +0200, Patrick Steinhardt wrote:
Show 13 quoted lines
> 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.
>
Right, will improve this.
> Patrick