Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/locale/collcmp.c
Show All 27 Lines | |||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <string.h> | #include <string.h> | ||||
#include <wchar.h> | |||||
#include <xlocale.h> | #include <xlocale.h> | ||||
#include "collate.h" | #include "collate.h" | ||||
/* | /* | ||||
* Compare two characters using collate | * Compare two characters using collate | ||||
*/ | */ | ||||
int __collate_range_cmp(struct xlocale_collate *table, int c1, int c2) | int __collate_range_cmp(struct xlocale_collate *table, wchar_t c1, wchar_t c2) | ||||
{ | { | ||||
static char s1[2], s2[2]; | wchar_t s1[2], s2[2]; | ||||
s1[0] = c1; | s1[0] = c1; | ||||
s1[1] = 0; | |||||
s2[0] = c2; | s2[0] = c2; | ||||
s2[1] = 0; | |||||
struct _xlocale l = {{0}}; | struct _xlocale l = {{0}}; | ||||
l.components[XLC_COLLATE] = (struct xlocale_component *)table; | l.components[XLC_COLLATE] = (struct xlocale_component *)table; | ||||
return (strcoll_l(s1, s2, &l)); | return (wcscoll_l(s1, s2, &l)); | ||||
} | } |