Re: [PATCH v2 22/37] libmultipath: sort aliases by length and strcmp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2023-09-13 at 09:38 -0500, Benjamin Marzinski wrote:
> On Wed, Sep 13, 2023 at 03:53:25PM +0200, Martin Wilck wrote:
> > On Tue, 2023-09-12 at 18:00 -0500, Benjamin Marzinski wrote:
> > > On Mon, Sep 11, 2023 at 06:38:31PM +0200, mwilck@xxxxxxxx wrote:
> > > > + */
> > > > +static int alias_compar(const void *p1, const void *p2)
> > > > +{
> > > 
> > > I'm confused as to why we need to pass p1 and p2 and pointers to
> > > pointers to chars, instead of simply as pointers to chars. We
> > > always
> > > derefence them immediately, and only use the dereferenced
> > > pointers.
> > > Am I
> > > missing something?
> > 
> > I wanted to make the relationship of alias_compar() and
> > mp_alias_compar() as obvious as possible. mp_alias_compar() takes 
> > (struct mpentry **) arguments, because it's used as an argument to
> > vector_sort() aka msort(), which has the same calling convention as
> > qsort()'s "compar" argument. Therefore I wrote alias_compar() such
> > that
> > it takes (char **) pointers. This way we could use alias_compar()
> > as an
> > argument to vector_sort() as well, even though we currently don't.
> > 
> > 
> > Does this make sense? If not, I can change it, but I think the
> > function
> > should not be named alias_compar() if it can't be passed to
> > vector_sort().
> 
> It's fine as it is. I was just confused as to why.

Can I take this as a reviewed-by?

Thanks,
Martin

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux