xref: /llvm-project/libc/src/string/strcoll_l.cpp (revision 5c019bdb7a008cf6465972d4affd8b2802465722)
1*5c019bdbSJoseph Huber //===-- Implementation of strcoll_l ---------------------------------------===//
2*5c019bdbSJoseph Huber //
3*5c019bdbSJoseph Huber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*5c019bdbSJoseph Huber // See https://llvm.org/LICENSE.txt for license information.
5*5c019bdbSJoseph Huber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*5c019bdbSJoseph Huber //
7*5c019bdbSJoseph Huber //===----------------------------------------------------------------------===//
8*5c019bdbSJoseph Huber 
9*5c019bdbSJoseph Huber #include "src/string/strcoll_l.h"
10*5c019bdbSJoseph Huber 
11*5c019bdbSJoseph Huber #include "src/__support/common.h"
12*5c019bdbSJoseph Huber #include "src/__support/macros/config.h"
13*5c019bdbSJoseph Huber 
14*5c019bdbSJoseph Huber namespace LIBC_NAMESPACE_DECL {
15*5c019bdbSJoseph Huber 
16*5c019bdbSJoseph Huber // TODO: Add support for locales.
17*5c019bdbSJoseph Huber LLVM_LIBC_FUNCTION(int, strcoll_l,
18*5c019bdbSJoseph Huber                    (const char *left, const char *right, locale_t)) {
19*5c019bdbSJoseph Huber   for (; *left && *left == *right; ++left, ++right)
20*5c019bdbSJoseph Huber     ;
21*5c019bdbSJoseph Huber   return static_cast<int>(*left) - static_cast<int>(*right);
22*5c019bdbSJoseph Huber }
23*5c019bdbSJoseph Huber 
24*5c019bdbSJoseph Huber } // namespace LIBC_NAMESPACE_DECL
25