1 /* Locale dependent, case and normalization insensitive comparison of Unicode
3 Copyright (C) 2009-2019 Free Software Foundation, Inc.
4 Written by Bruno Haible <bruno@clisp.org>, 2009.
6 This program is free software: you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
20 FUNC (const UNIT
*s1
, size_t n1
, const UNIT
*s2
, size_t n2
,
21 const char *iso639_language
, uninorm_t nf
, int *resultp
)
26 size_t transformed1_length
;
28 size_t transformed2_length
;
31 /* Normalize and transform S1. */
32 transformed1_length
= sizeof (buf1
);
34 U_CASEXFRM (s1
, n1
, iso639_language
, nf
, buf1
, &transformed1_length
);
35 if (transformed1
== NULL
)
36 /* errno is set here. */
39 /* Normalize and transform S2. */
40 transformed2_length
= sizeof (buf2
);
42 U_CASEXFRM (s2
, n2
, iso639_language
, nf
, buf2
, &transformed2_length
);
43 if (transformed2
== NULL
)
45 if (transformed1
!= buf1
)
47 int saved_errno
= errno
;
54 /* Compare the transformed strings. */
55 cmp
= memcmp2 (transformed1
, transformed1_length
,
56 transformed2
, transformed2_length
);
62 if (transformed2
!= buf2
)
64 if (transformed1
!= buf1
)