mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
Add comment explaining what function does
Cover strcoll return 0 case too
This commit is contained in:
parent
7b8830a51e
commit
cb07d7668c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=18331
1 changed files with 11 additions and 3 deletions
|
@ -23,7 +23,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: collcmp.c,v 1.5 1996/08/14 19:47:02 ache Exp $
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -31,10 +31,16 @@
|
|||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
|
||||
/*
|
||||
* Compare two characters converting collate information
|
||||
* into ASCII-compatible range, it allows to handle
|
||||
* "[a-z]"-type ranges with national characters.
|
||||
*/
|
||||
|
||||
int collate_range_cmp (c1, c2)
|
||||
int c1, c2;
|
||||
{
|
||||
int as1, as2, al1, al2;
|
||||
int as1, as2, al1, al2, ret;
|
||||
static char s1[2], s2[2];
|
||||
|
||||
c1 &= UCHAR_MAX;
|
||||
|
@ -65,5 +71,7 @@ int collate_range_cmp (c1, c2)
|
|||
|
||||
s1[0] = c1;
|
||||
s2[0] = c2;
|
||||
return strcoll(s1, s2);
|
||||
if ((ret = strcoll(s1, s2)) != 0)
|
||||
return (ret);
|
||||
return (c1 - c2);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue