Subject: [RFH] renaming strcmp/strncmp-icase

From: Junio C Hamano <[email-masked]>
Date: Mon, 08 Sep 2014 11:52:47 -0700

There are these two functions in dir.c that has only a handful of
callers outside:

    int strcmp_icase(const char *a, const char *b);
    int strncmp_icase(const char *a, const char *b, size_t count);

How many of you would think these are about comparing two strings in
a case-insensitive way?

If you raised your hand (like I did), you were wrong.  These do
comparison case-insensitively only on a case-insensitive filesystem,
and hence calling it makes sense only for pathnames you grabbed out
of the filesystem via readdir() (or the user gave us, intending to
name paths).

To avoid confusion, I think they should be renamed to stress the
fact that these are about comparing *PATHS*.  As I always say, I am
bad at naming things and good suggestions are appreciated.

FYI, there are names I thought about and haven't managed to convince
myself that they are good.

A good name for the non-n variant may be "compare_paths()", but that
is used in "combine-diff.c".  "compare_pathnames()" may be a
compromise.

However, either of these makes it hard to come up with a
corresponding name for the "n" (counted) variant.  The best I could
do was "compare_pathnames_counted()", but a nice similarity to
strcmp()/strncmp() pair is lost.

pathnamecmp()/pathnamencmp() perhaps?

I dunno.