On Tue, Jan 19, 2021 at 01:43:39PM +0300, Dan Carpenter wrote: > On Mon, Jan 04, 2021 at 01:17:55AM +0200, Kari Argillander wrote: > > On Thu, Dec 31, 2020 at 06:23:52PM +0300, Konstantin Komarov wrote: > > > > > +int ntfs_cmp_names(const __le16 *s1, size_t l1, const __le16 *s2, size_t l2, > > > + const u16 *upcase) > > > +{ > > > + int diff; > > > + size_t len = l1 < l2 ? l1 : l2; > > > > I notice that these functions might call both ignore case and upcase in a row. > > record.c - compare_attr() > > index.c - cmp_fnames() > > > > So maybe we can add bool bothcases. > > > > int ntfs_cmp_names(const __le16 *s1, size_t l1, const __le16 *s2, size_t l2, > > const u16 *upcase, bool bothcase) > > { > > int diff1 = 0; > > int diff2; > > size_t len = l1 < l2 ? l1 : l2; > > size_t len = min(l1, l2); > > I wonder if this could be a Coccinelle script? Yeah I have to also confess that I just copy paste that. Didn't use brain yet. Atleast to me it wasn't crystal clear right away what that does. So Coccinelle script would definetly be good idea. Someone has atleast made it https://github.com/bhumikagoyal/coccinelle_scripts I wonder if we need to add cases also in "backwards". Haven't test these. If patch is prefered from me then I can send it but someone else can also send it. @@ type T; T x; T y; @@ ( - x < y ? x : y + min(x,y) | - x > y ? x : y + max(x,y) | - x < y ? y : x + max(x,y) | - x > y ? y : x + min(x,y) )