/src/libunistring/lib/unistr.h
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */  | 
2  |  | /* Elementary Unicode string functions.  | 
3  |  |    Copyright (C) 2001-2002, 2005-2023 Free Software Foundation, Inc.  | 
4  |  |  | 
5  |  |    This file is free software: you can redistribute it and/or modify  | 
6  |  |    it under the terms of the GNU Lesser General Public License as  | 
7  |  |    published by the Free Software Foundation; either version 2.1 of the  | 
8  |  |    License, or (at your option) any later version.  | 
9  |  |  | 
10  |  |    This file is distributed in the hope that it will be useful,  | 
11  |  |    but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
12  |  |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  | 
13  |  |    GNU Lesser General Public License for more details.  | 
14  |  |  | 
15  |  |    You should have received a copy of the GNU Lesser General Public License  | 
16  |  |    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */  | 
17  |  |  | 
18  |  | #ifndef _UNISTR_H  | 
19  |  | #define _UNISTR_H  | 
20  |  |  | 
21  |  | #include "unitypes.h"  | 
22  |  |  | 
23  |  | /* Get common macros for C.  */  | 
24  |  | #include <unistring/cdefs.h>  | 
25  |  |  | 
26  |  | /* Get inline if available.  */  | 
27  |  | #include <unistring/inline.h>  | 
28  |  |  | 
29  |  | /* Get bool.  */  | 
30  |  | #include <unistring/stdbool.h>  | 
31  |  |  | 
32  |  | /* Get size_t, ptrdiff_t.  */  | 
33  |  | #include <stddef.h>  | 
34  |  |  | 
35  |  | /* Get free().  */  | 
36  |  | #include <stdlib.h>  | 
37  |  |  | 
38  |  | #ifdef __cplusplus  | 
39  |  | extern "C" { | 
40  |  | #endif  | 
41  |  |  | 
42  |  |  | 
43  |  | /* Conventions:  | 
44  |  |  | 
45  |  |    All functions prefixed with u8_ operate on UTF-8 encoded strings.  | 
46  |  |    Their unit is an uint8_t (1 byte).  | 
47  |  |  | 
48  |  |    All functions prefixed with u16_ operate on UTF-16 encoded strings.  | 
49  |  |    Their unit is an uint16_t (a 2-byte word).  | 
50  |  |  | 
51  |  |    All functions prefixed with u32_ operate on UCS-4 encoded strings.  | 
52  |  |    Their unit is an uint32_t (a 4-byte word).  | 
53  |  |  | 
54  |  |    All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly  | 
55  |  |    n units.  | 
56  |  |  | 
57  |  |    All arguments starting with "str" and the arguments of functions starting  | 
58  |  |    with u8_str/u16_str/u32_str denote a NUL terminated string, i.e. a string  | 
59  |  |    which terminates at the first NUL unit.  This termination unit is  | 
60  |  |    considered part of the string for all memory allocation purposes, but  | 
61  |  |    is not considered part of the string for all other logical purposes.  | 
62  |  |  | 
63  |  |    Functions returning a string result take a (resultbuf, lengthp) argument  | 
64  |  |    pair.  If resultbuf is not NULL and the result fits into *lengthp units,  | 
65  |  |    it is put in resultbuf, and resultbuf is returned.  Otherwise, a freshly  | 
66  |  |    allocated string is returned.  In both cases, *lengthp is set to the  | 
67  |  |    length (number of units) of the returned string.  In case of error,  | 
68  |  |    NULL is returned and errno is set.  */  | 
69  |  |  | 
70  |  |  | 
71  |  | /* Elementary string checks.  */  | 
72  |  |  | 
73  |  | /* Check whether an UTF-8 string is well-formed.  | 
74  |  |    Return NULL if valid, or a pointer to the first invalid unit otherwise.  */  | 
75  |  | extern const uint8_t *  | 
76  |  |        u8_check (const uint8_t *s, size_t n)  | 
77  |  |        _UC_ATTRIBUTE_PURE;  | 
78  |  |  | 
79  |  | /* Check whether an UTF-16 string is well-formed.  | 
80  |  |    Return NULL if valid, or a pointer to the first invalid unit otherwise.  */  | 
81  |  | extern const uint16_t *  | 
82  |  |        u16_check (const uint16_t *s, size_t n)  | 
83  |  |        _UC_ATTRIBUTE_PURE;  | 
84  |  |  | 
85  |  | /* Check whether an UCS-4 string is well-formed.  | 
86  |  |    Return NULL if valid, or a pointer to the first invalid unit otherwise.  */  | 
87  |  | extern const uint32_t *  | 
88  |  |        u32_check (const uint32_t *s, size_t n)  | 
89  |  |        _UC_ATTRIBUTE_PURE;  | 
90  |  |  | 
91  |  |  | 
92  |  | /* Elementary string conversions.  */  | 
93  |  |  | 
94  |  | /* Convert an UTF-8 string to an UTF-16 string.  */  | 
95  |  | extern uint16_t *  | 
96  |  |        u8_to_u16 (const uint8_t *s, size_t n, uint16_t *resultbuf,  | 
97  |  |                   size_t *lengthp);  | 
98  |  |  | 
99  |  | /* Convert an UTF-8 string to an UCS-4 string.  */  | 
100  |  | extern uint32_t *  | 
101  |  |        u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf,  | 
102  |  |                   size_t *lengthp);  | 
103  |  |  | 
104  |  | /* Convert an UTF-16 string to an UTF-8 string.  */  | 
105  |  | extern uint8_t *  | 
106  |  |        u16_to_u8 (const uint16_t *s, size_t n, uint8_t *resultbuf,  | 
107  |  |                   size_t *lengthp);  | 
108  |  |  | 
109  |  | /* Convert an UTF-16 string to an UCS-4 string.  */  | 
110  |  | extern uint32_t *  | 
111  |  |        u16_to_u32 (const uint16_t *s, size_t n, uint32_t *resultbuf,  | 
112  |  |                    size_t *lengthp);  | 
113  |  |  | 
114  |  | /* Convert an UCS-4 string to an UTF-8 string.  */  | 
115  |  | extern uint8_t *  | 
116  |  |        u32_to_u8 (const uint32_t *s, size_t n, uint8_t *resultbuf,  | 
117  |  |                   size_t *lengthp);  | 
118  |  |  | 
119  |  | /* Convert an UCS-4 string to an UTF-16 string.  */  | 
120  |  | extern uint16_t *  | 
121  |  |        u32_to_u16 (const uint32_t *s, size_t n, uint16_t *resultbuf,  | 
122  |  |                    size_t *lengthp);  | 
123  |  |  | 
124  |  |  | 
125  |  | /* Elementary string functions.  */  | 
126  |  |  | 
127  |  | /* Return the length (number of units) of the first character in S, which is  | 
128  |  |    no longer than N.  Return 0 if it is the NUL character.  Return -1 upon  | 
129  |  |    failure.  */  | 
130  |  | /* Similar to mblen(), except that s must not be NULL.  */  | 
131  |  | extern int  | 
132  |  |        u8_mblen (const uint8_t *s, size_t n)  | 
133  |  |        _UC_ATTRIBUTE_PURE;  | 
134  |  | extern int  | 
135  |  |        u16_mblen (const uint16_t *s, size_t n)  | 
136  |  |        _UC_ATTRIBUTE_PURE;  | 
137  |  | extern int  | 
138  |  |        u32_mblen (const uint32_t *s, size_t n)  | 
139  |  |        _UC_ATTRIBUTE_PURE;  | 
140  |  |  | 
141  |  | /* Return the length (number of units) of the first character in S, putting  | 
142  |  |    its 'ucs4_t' representation in *PUC.  Upon failure, *PUC is set to 0xfffd,  | 
143  |  |    and an appropriate number of units is returned.  | 
144  |  |    The number of available units, N, must be > 0.  */  | 
145  |  | /* Similar to mbtowc(), except that puc and s must not be NULL, n must be > 0,  | 
146  |  |    and the NUL character is not treated specially.  */  | 
147  |  | /* The variants with _unsafe suffix are for backward compatibility with  | 
148  |  |    libunistring versions < 0.9.7.  */  | 
149  |  |  | 
150  |  | #if 1  | 
151  |  | # if !UNISTRING_HAVE_INLINE  | 
152  |  | extern int  | 
153  |  |        u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n);  | 
154  |  | # else  | 
155  |  | extern int  | 
156  |  |        u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n);  | 
157  |  | static inline int  | 
158  |  | u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)  | 
159  | 44.9M  | { | 
160  | 44.9M  |   uint8_t c = *s;  | 
161  |  |  | 
162  | 44.9M  |   if (c < 0x80)  | 
163  | 16.4M  |     { | 
164  | 16.4M  |       *puc = c;  | 
165  | 16.4M  |       return 1;  | 
166  | 16.4M  |     }  | 
167  | 28.4M  |   else  | 
168  | 28.4M  |     return u8_mbtouc_unsafe_aux (puc, s, n);  | 
169  | 44.9M  | } Unexecuted instantiation: u8-strconv-from-enc.c:u8_mbtouc_unsafe Unexecuted instantiation: u32-normalize.c:u8_mbtouc_unsafe Unexecuted instantiation: u32-cmp.c:u8_mbtouc_unsafe Unexecuted instantiation: u32-cpy.c:u8_mbtouc_unsafe Unexecuted instantiation: u32-strlen.c:u8_mbtouc_unsafe Unexecuted instantiation: u32-to-u8.c:u8_mbtouc_unsafe Unexecuted instantiation: u8-strlen.c:u8_mbtouc_unsafe Unexecuted instantiation: u8-to-u32.c:u8_mbtouc_unsafe Unexecuted instantiation: u8-uctomb-aux.c:u8_mbtouc_unsafe u8-casemap.c:u8_mbtouc_unsafe Line  | Count  | Source  |  159  | 22.4M  | { |  160  | 22.4M  |   uint8_t c = *s;  |  161  |  |  |  162  | 22.4M  |   if (c < 0x80)  |  163  | 8.22M  |     { |  164  | 8.22M  |       *puc = c;  |  165  | 8.22M  |       return 1;  |  166  | 8.22M  |     }  |  167  | 14.2M  |   else  |  168  | 14.2M  |     return u8_mbtouc_unsafe_aux (puc, s, n);  |  169  | 22.4M  | }  |  
 Unexecuted instantiation: u8-conv-from-enc.c:u8_mbtouc_unsafe u8-normalize.c:u8_mbtouc_unsafe Line  | Count  | Source  |  159  | 22.4M  | { |  160  | 22.4M  |   uint8_t c = *s;  |  161  |  |  |  162  | 22.4M  |   if (c < 0x80)  |  163  | 8.22M  |     { |  164  | 8.22M  |       *puc = c;  |  165  | 8.22M  |       return 1;  |  166  | 8.22M  |     }  |  167  | 14.2M  |   else  |  168  | 14.2M  |     return u8_mbtouc_unsafe_aux (puc, s, n);  |  169  | 22.4M  | }  |  
 Unexecuted instantiation: u8-check.c:u8_mbtouc_unsafe Unexecuted instantiation: u8-cpy.c:u8_mbtouc_unsafe Unexecuted instantiation: u8-mblen.c:u8_mbtouc_unsafe Unexecuted instantiation: u8-mbtouc-unsafe-aux.c:u8_mbtouc_unsafe Unexecuted instantiation: u8-mbtoucr.c:u8_mbtouc_unsafe Unexecuted instantiation: striconveh.c:u8_mbtouc_unsafe Unexecuted instantiation: u8-mbtouc-aux.c:u8_mbtouc_unsafe Unexecuted instantiation: u8-prev.c:u8_mbtouc_unsafe  | 
170  |  | # endif  | 
171  |  | #endif  | 
172  |  |  | 
173  |  | #if 1  | 
174  |  | # if !UNISTRING_HAVE_INLINE  | 
175  |  | extern int  | 
176  |  |        u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n);  | 
177  |  | # else  | 
178  |  | extern int  | 
179  |  |        u16_mbtouc_unsafe_aux (ucs4_t *puc, const uint16_t *s, size_t n);  | 
180  |  | static inline int  | 
181  |  | u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n)  | 
182  | 0  | { | 
183  | 0  |   uint16_t c = *s;  | 
184  | 0  | 
  | 
185  | 0  |   if (c < 0xd800 || c >= 0xe000)  | 
186  | 0  |     { | 
187  | 0  |       *puc = c;  | 
188  | 0  |       return 1;  | 
189  | 0  |     }  | 
190  | 0  |   else  | 
191  | 0  |     return u16_mbtouc_unsafe_aux (puc, s, n);  | 
192  | 0  | } Unexecuted instantiation: u8-strconv-from-enc.c:u16_mbtouc_unsafe Unexecuted instantiation: u32-normalize.c:u16_mbtouc_unsafe Unexecuted instantiation: u32-cmp.c:u16_mbtouc_unsafe Unexecuted instantiation: u32-cpy.c:u16_mbtouc_unsafe Unexecuted instantiation: u32-strlen.c:u16_mbtouc_unsafe Unexecuted instantiation: u32-to-u8.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-strlen.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-to-u32.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-uctomb-aux.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-casemap.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-conv-from-enc.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-normalize.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-check.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-cpy.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-mblen.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-mbtouc-unsafe-aux.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-mbtoucr.c:u16_mbtouc_unsafe Unexecuted instantiation: striconveh.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-mbtouc-aux.c:u16_mbtouc_unsafe Unexecuted instantiation: u8-prev.c:u16_mbtouc_unsafe  | 
193  |  | # endif  | 
194  |  | #endif  | 
195  |  |  | 
196  |  | #if 1  | 
197  |  | # if !UNISTRING_HAVE_INLINE  | 
198  |  | extern int  | 
199  |  |        u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);  | 
200  |  | # else  | 
201  |  | static inline int  | 
202  |  | u32_mbtouc_unsafe (ucs4_t *puc,  | 
203  |  |                    const uint32_t *s, _GL_ATTRIBUTE_MAYBE_UNUSED size_t n)  | 
204  | 20.9M  | { | 
205  | 20.9M  |   uint32_t c = *s;  | 
206  |  |  | 
207  | 20.9M  |   if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))  | 
208  | 20.9M  |     *puc = c;  | 
209  | 197  |   else  | 
210  |  |     /* invalid multibyte character */  | 
211  | 197  |     *puc = 0xfffd;  | 
212  | 20.9M  |   return 1;  | 
213  | 20.9M  | } Unexecuted instantiation: u8-strconv-from-enc.c:u32_mbtouc_unsafe u32-normalize.c:u32_mbtouc_unsafe Line  | Count  | Source  |  204  | 20.9M  | { |  205  | 20.9M  |   uint32_t c = *s;  |  206  |  |  |  207  | 20.9M  |   if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))  |  208  | 20.9M  |     *puc = c;  |  209  | 197  |   else  |  210  |  |     /* invalid multibyte character */  |  211  | 197  |     *puc = 0xfffd;  |  212  | 20.9M  |   return 1;  |  213  | 20.9M  | }  |  
 Unexecuted instantiation: u32-cmp.c:u32_mbtouc_unsafe Unexecuted instantiation: u32-cpy.c:u32_mbtouc_unsafe Unexecuted instantiation: u32-strlen.c:u32_mbtouc_unsafe Unexecuted instantiation: u32-to-u8.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-strlen.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-to-u32.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-uctomb-aux.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-casemap.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-conv-from-enc.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-normalize.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-check.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-cpy.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-mblen.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-mbtouc-unsafe-aux.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-mbtoucr.c:u32_mbtouc_unsafe Unexecuted instantiation: striconveh.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-mbtouc-aux.c:u32_mbtouc_unsafe Unexecuted instantiation: u8-prev.c:u32_mbtouc_unsafe  | 
214  |  | # endif  | 
215  |  | #endif  | 
216  |  |  | 
217  |  | #if 1  | 
218  |  | # if !UNISTRING_HAVE_INLINE  | 
219  |  | extern int  | 
220  |  |        u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n);  | 
221  |  | # else  | 
222  |  | extern int  | 
223  |  |        u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n);  | 
224  |  | static inline int  | 
225  |  | u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)  | 
226  | 0  | { | 
227  | 0  |   uint8_t c = *s;  | 
228  |  | 
  | 
229  | 0  |   if (c < 0x80)  | 
230  | 0  |     { | 
231  | 0  |       *puc = c;  | 
232  | 0  |       return 1;  | 
233  | 0  |     }  | 
234  | 0  |   else  | 
235  | 0  |     return u8_mbtouc_aux (puc, s, n);  | 
236  | 0  | } Unexecuted instantiation: u8-strconv-from-enc.c:u8_mbtouc Unexecuted instantiation: u32-normalize.c:u8_mbtouc Unexecuted instantiation: u32-cmp.c:u8_mbtouc Unexecuted instantiation: u32-cpy.c:u8_mbtouc Unexecuted instantiation: u32-strlen.c:u8_mbtouc Unexecuted instantiation: u32-to-u8.c:u8_mbtouc Unexecuted instantiation: u8-strlen.c:u8_mbtouc Unexecuted instantiation: u8-to-u32.c:u8_mbtouc Unexecuted instantiation: u8-uctomb-aux.c:u8_mbtouc Unexecuted instantiation: u8-casemap.c:u8_mbtouc Unexecuted instantiation: u8-conv-from-enc.c:u8_mbtouc Unexecuted instantiation: u8-normalize.c:u8_mbtouc Unexecuted instantiation: u8-check.c:u8_mbtouc Unexecuted instantiation: u8-cpy.c:u8_mbtouc Unexecuted instantiation: u8-mblen.c:u8_mbtouc Unexecuted instantiation: u8-mbtouc-unsafe-aux.c:u8_mbtouc Unexecuted instantiation: u8-mbtoucr.c:u8_mbtouc Unexecuted instantiation: striconveh.c:u8_mbtouc Unexecuted instantiation: u8-mbtouc-aux.c:u8_mbtouc Unexecuted instantiation: u8-prev.c:u8_mbtouc  | 
237  |  | # endif  | 
238  |  | #endif  | 
239  |  |  | 
240  |  | #if 1  | 
241  |  | # if !UNISTRING_HAVE_INLINE  | 
242  |  | extern int  | 
243  |  |        u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n);  | 
244  |  | # else  | 
245  |  | extern int  | 
246  |  |        u16_mbtouc_aux (ucs4_t *puc, const uint16_t *s, size_t n);  | 
247  |  | static inline int  | 
248  |  | u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n)  | 
249  | 0  | { | 
250  | 0  |   uint16_t c = *s;  | 
251  | 0  | 
  | 
252  | 0  |   if (c < 0xd800 || c >= 0xe000)  | 
253  | 0  |     { | 
254  | 0  |       *puc = c;  | 
255  | 0  |       return 1;  | 
256  | 0  |     }  | 
257  | 0  |   else  | 
258  | 0  |     return u16_mbtouc_aux (puc, s, n);  | 
259  | 0  | } Unexecuted instantiation: u8-strconv-from-enc.c:u16_mbtouc Unexecuted instantiation: u32-normalize.c:u16_mbtouc Unexecuted instantiation: u32-cmp.c:u16_mbtouc Unexecuted instantiation: u32-cpy.c:u16_mbtouc Unexecuted instantiation: u32-strlen.c:u16_mbtouc Unexecuted instantiation: u32-to-u8.c:u16_mbtouc Unexecuted instantiation: u8-strlen.c:u16_mbtouc Unexecuted instantiation: u8-to-u32.c:u16_mbtouc Unexecuted instantiation: u8-uctomb-aux.c:u16_mbtouc Unexecuted instantiation: u8-casemap.c:u16_mbtouc Unexecuted instantiation: u8-conv-from-enc.c:u16_mbtouc Unexecuted instantiation: u8-normalize.c:u16_mbtouc Unexecuted instantiation: u8-check.c:u16_mbtouc Unexecuted instantiation: u8-cpy.c:u16_mbtouc Unexecuted instantiation: u8-mblen.c:u16_mbtouc Unexecuted instantiation: u8-mbtouc-unsafe-aux.c:u16_mbtouc Unexecuted instantiation: u8-mbtoucr.c:u16_mbtouc Unexecuted instantiation: striconveh.c:u16_mbtouc Unexecuted instantiation: u8-mbtouc-aux.c:u16_mbtouc Unexecuted instantiation: u8-prev.c:u16_mbtouc  | 
260  |  | # endif  | 
261  |  | #endif  | 
262  |  |  | 
263  |  | #if 1  | 
264  |  | # if !UNISTRING_HAVE_INLINE  | 
265  |  | extern int  | 
266  |  |        u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);  | 
267  |  | # else  | 
268  |  | static inline int  | 
269  |  | u32_mbtouc (ucs4_t *puc, const uint32_t *s,  | 
270  |  |             _GL_ATTRIBUTE_MAYBE_UNUSED size_t n)  | 
271  | 0  | { | 
272  | 0  |   uint32_t c = *s;  | 
273  | 0  | 
  | 
274  | 0  |   if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))  | 
275  | 0  |     *puc = c;  | 
276  | 0  |   else  | 
277  | 0  |     /* invalid multibyte character */  | 
278  | 0  |     *puc = 0xfffd;  | 
279  | 0  |   return 1;  | 
280  | 0  | } Unexecuted instantiation: u8-strconv-from-enc.c:u32_mbtouc Unexecuted instantiation: u32-normalize.c:u32_mbtouc Unexecuted instantiation: u32-cmp.c:u32_mbtouc Unexecuted instantiation: u32-cpy.c:u32_mbtouc Unexecuted instantiation: u32-strlen.c:u32_mbtouc Unexecuted instantiation: u32-to-u8.c:u32_mbtouc Unexecuted instantiation: u8-strlen.c:u32_mbtouc Unexecuted instantiation: u8-to-u32.c:u32_mbtouc Unexecuted instantiation: u8-uctomb-aux.c:u32_mbtouc Unexecuted instantiation: u8-casemap.c:u32_mbtouc Unexecuted instantiation: u8-conv-from-enc.c:u32_mbtouc Unexecuted instantiation: u8-normalize.c:u32_mbtouc Unexecuted instantiation: u8-check.c:u32_mbtouc Unexecuted instantiation: u8-cpy.c:u32_mbtouc Unexecuted instantiation: u8-mblen.c:u32_mbtouc Unexecuted instantiation: u8-mbtouc-unsafe-aux.c:u32_mbtouc Unexecuted instantiation: u8-mbtoucr.c:u32_mbtouc Unexecuted instantiation: striconveh.c:u32_mbtouc Unexecuted instantiation: u8-mbtouc-aux.c:u32_mbtouc Unexecuted instantiation: u8-prev.c:u32_mbtouc  | 
281  |  | # endif  | 
282  |  | #endif  | 
283  |  |  | 
284  |  | /* Return the length (number of units) of the first character in S, putting  | 
285  |  |    its 'ucs4_t' representation in *PUC.  Upon failure, *PUC is set to 0xfffd,  | 
286  |  |    and -1 is returned for an invalid sequence of units, -2 is returned for an  | 
287  |  |    incomplete sequence of units.  | 
288  |  |    The number of available units, N, must be > 0.  */  | 
289  |  | /* Similar to u*_mbtouc(), except that the return value gives more details  | 
290  |  |    about the failure, similar to mbrtowc().  */  | 
291  |  |  | 
292  |  | #if 1  | 
293  |  | extern int  | 
294  |  |        u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n);  | 
295  |  | #endif  | 
296  |  |  | 
297  |  | #if 1  | 
298  |  | extern int  | 
299  |  |        u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n);  | 
300  |  | #endif  | 
301  |  |  | 
302  |  | #if 1  | 
303  |  | extern int  | 
304  |  |        u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n);  | 
305  |  | #endif  | 
306  |  |  | 
307  |  | /* Put the multibyte character represented by UC in S, returning its  | 
308  |  |    length.  Return -1 upon failure, -2 if the number of available units, N,  | 
309  |  |    is too small.  The latter case cannot occur if N >= 6/2/1, respectively.  */  | 
310  |  | /* Similar to wctomb(), except that s must not be NULL, and the argument n  | 
311  |  |    must be specified.  */  | 
312  |  |  | 
313  |  | #if 1  | 
314  |  | /* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr.  */  | 
315  |  | extern int  | 
316  |  |        u8_uctomb_aux (uint8_t *s, ucs4_t uc, ptrdiff_t n);  | 
317  |  | # if !UNISTRING_HAVE_INLINE  | 
318  |  | extern int  | 
319  |  |        u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n);  | 
320  |  | # else  | 
321  |  | static inline int  | 
322  |  | u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n)  | 
323  | 71.9M  | { | 
324  | 71.9M  |   if (uc < 0x80 && n > 0)  | 
325  | 26.1M  |     { | 
326  | 26.1M  |       s[0] = uc;  | 
327  | 26.1M  |       return 1;  | 
328  | 26.1M  |     }  | 
329  | 45.7M  |   else  | 
330  | 45.7M  |     return u8_uctomb_aux (s, uc, n);  | 
331  | 71.9M  | } Unexecuted instantiation: u8-strconv-from-enc.c:u8_uctomb Unexecuted instantiation: u32-normalize.c:u8_uctomb Unexecuted instantiation: u32-cmp.c:u8_uctomb Unexecuted instantiation: u32-cpy.c:u8_uctomb Unexecuted instantiation: u32-strlen.c:u8_uctomb Line  | Count  | Source  |  323  | 19.1M  | { |  324  | 19.1M  |   if (uc < 0x80 && n > 0)  |  325  | 7.80M  |     { |  326  | 7.80M  |       s[0] = uc;  |  327  | 7.80M  |       return 1;  |  328  | 7.80M  |     }  |  329  | 11.3M  |   else  |  330  | 11.3M  |     return u8_uctomb_aux (s, uc, n);  |  331  | 19.1M  | }  |  
 Unexecuted instantiation: u8-strlen.c:u8_uctomb Unexecuted instantiation: u8-to-u32.c:u8_uctomb Unexecuted instantiation: u8-uctomb-aux.c:u8_uctomb Line  | Count  | Source  |  323  | 22.4M  | { |  324  | 22.4M  |   if (uc < 0x80 && n > 0)  |  325  | 8.22M  |     { |  326  | 8.22M  |       s[0] = uc;  |  327  | 8.22M  |       return 1;  |  328  | 8.22M  |     }  |  329  | 14.2M  |   else  |  330  | 14.2M  |     return u8_uctomb_aux (s, uc, n);  |  331  | 22.4M  | }  |  
 Unexecuted instantiation: u8-conv-from-enc.c:u8_uctomb Line  | Count  | Source  |  323  | 30.3M  | { |  324  | 30.3M  |   if (uc < 0x80 && n > 0)  |  325  | 10.1M  |     { |  326  | 10.1M  |       s[0] = uc;  |  327  | 10.1M  |       return 1;  |  328  | 10.1M  |     }  |  329  | 20.2M  |   else  |  330  | 20.2M  |     return u8_uctomb_aux (s, uc, n);  |  331  | 30.3M  | }  |  
 Unexecuted instantiation: u8-check.c:u8_uctomb Unexecuted instantiation: u8-cpy.c:u8_uctomb Unexecuted instantiation: u8-mblen.c:u8_uctomb Unexecuted instantiation: u8-mbtouc-unsafe-aux.c:u8_uctomb Unexecuted instantiation: u8-mbtoucr.c:u8_uctomb Unexecuted instantiation: striconveh.c:u8_uctomb Unexecuted instantiation: u8-mbtouc-aux.c:u8_uctomb Unexecuted instantiation: u8-prev.c:u8_uctomb  | 
332  |  | # endif  | 
333  |  | #endif  | 
334  |  |  | 
335  |  | #if 1  | 
336  |  | /* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr.  */  | 
337  |  | extern int  | 
338  |  |        u16_uctomb_aux (uint16_t *s, ucs4_t uc, ptrdiff_t n);  | 
339  |  | # if !UNISTRING_HAVE_INLINE  | 
340  |  | extern int  | 
341  |  |        u16_uctomb (uint16_t *s, ucs4_t uc, ptrdiff_t n);  | 
342  |  | # else  | 
343  |  | static inline int  | 
344  |  | u16_uctomb (uint16_t *s, ucs4_t uc, ptrdiff_t n)  | 
345  | 0  | { | 
346  | 0  |   if (uc < 0xd800 && n > 0)  | 
347  | 0  |     { | 
348  | 0  |       s[0] = uc;  | 
349  | 0  |       return 1;  | 
350  | 0  |     }  | 
351  | 0  |   else  | 
352  | 0  |     return u16_uctomb_aux (s, uc, n);  | 
353  | 0  | } Unexecuted instantiation: u8-strconv-from-enc.c:u16_uctomb Unexecuted instantiation: u32-normalize.c:u16_uctomb Unexecuted instantiation: u32-cmp.c:u16_uctomb Unexecuted instantiation: u32-cpy.c:u16_uctomb Unexecuted instantiation: u32-strlen.c:u16_uctomb Unexecuted instantiation: u32-to-u8.c:u16_uctomb Unexecuted instantiation: u8-strlen.c:u16_uctomb Unexecuted instantiation: u8-to-u32.c:u16_uctomb Unexecuted instantiation: u8-uctomb-aux.c:u16_uctomb Unexecuted instantiation: u8-casemap.c:u16_uctomb Unexecuted instantiation: u8-conv-from-enc.c:u16_uctomb Unexecuted instantiation: u8-normalize.c:u16_uctomb Unexecuted instantiation: u8-check.c:u16_uctomb Unexecuted instantiation: u8-cpy.c:u16_uctomb Unexecuted instantiation: u8-mblen.c:u16_uctomb Unexecuted instantiation: u8-mbtouc-unsafe-aux.c:u16_uctomb Unexecuted instantiation: u8-mbtoucr.c:u16_uctomb Unexecuted instantiation: striconveh.c:u16_uctomb Unexecuted instantiation: u8-mbtouc-aux.c:u16_uctomb Unexecuted instantiation: u8-prev.c:u16_uctomb  | 
354  |  | # endif  | 
355  |  | #endif  | 
356  |  |  | 
357  |  | #if 1  | 
358  |  | # if !UNISTRING_HAVE_INLINE  | 
359  |  | extern int  | 
360  |  |        u32_uctomb (uint32_t *s, ucs4_t uc, ptrdiff_t n);  | 
361  |  | # else  | 
362  |  | static inline int  | 
363  |  | u32_uctomb (uint32_t *s, ucs4_t uc, ptrdiff_t n)  | 
364  | 20.9M  | { | 
365  | 20.9M  |   if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000))  | 
366  | 20.9M  |     { | 
367  | 20.9M  |       if (n > 0)  | 
368  | 20.9M  |         { | 
369  | 20.9M  |           *s = uc;  | 
370  | 20.9M  |           return 1;  | 
371  | 20.9M  |         }  | 
372  | 0  |       else  | 
373  | 0  |         return -2;  | 
374  | 20.9M  |     }  | 
375  | 0  |   else  | 
376  | 0  |     return -1;  | 
377  | 20.9M  | } Unexecuted instantiation: u8-strconv-from-enc.c:u32_uctomb u32-normalize.c:u32_uctomb Line  | Count  | Source  |  364  | 20.9M  | { |  365  | 20.9M  |   if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000))  |  366  | 20.9M  |     { |  367  | 20.9M  |       if (n > 0)  |  368  | 20.9M  |         { |  369  | 20.9M  |           *s = uc;  |  370  | 20.9M  |           return 1;  |  371  | 20.9M  |         }  |  372  | 0  |       else  |  373  | 0  |         return -2;  |  374  | 20.9M  |     }  |  375  | 0  |   else  |  376  | 0  |     return -1;  |  377  | 20.9M  | }  |  
 Unexecuted instantiation: u32-cmp.c:u32_uctomb Unexecuted instantiation: u32-cpy.c:u32_uctomb Unexecuted instantiation: u32-strlen.c:u32_uctomb Unexecuted instantiation: u32-to-u8.c:u32_uctomb Unexecuted instantiation: u8-strlen.c:u32_uctomb Unexecuted instantiation: u8-to-u32.c:u32_uctomb Unexecuted instantiation: u8-uctomb-aux.c:u32_uctomb Unexecuted instantiation: u8-casemap.c:u32_uctomb Unexecuted instantiation: u8-conv-from-enc.c:u32_uctomb Unexecuted instantiation: u8-normalize.c:u32_uctomb Unexecuted instantiation: u8-check.c:u32_uctomb Unexecuted instantiation: u8-cpy.c:u32_uctomb Unexecuted instantiation: u8-mblen.c:u32_uctomb Unexecuted instantiation: u8-mbtouc-unsafe-aux.c:u32_uctomb Unexecuted instantiation: u8-mbtoucr.c:u32_uctomb Unexecuted instantiation: striconveh.c:u32_uctomb Unexecuted instantiation: u8-mbtouc-aux.c:u32_uctomb Unexecuted instantiation: u8-prev.c:u32_uctomb  | 
378  |  | # endif  | 
379  |  | #endif  | 
380  |  |  | 
381  |  | /* Copy N units from SRC to DEST.  */  | 
382  |  | /* Similar to memcpy().  */  | 
383  |  | extern uint8_t *  | 
384  |  |        u8_cpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);  | 
385  |  | extern uint16_t *  | 
386  |  |        u16_cpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);  | 
387  |  | extern uint32_t *  | 
388  |  |        u32_cpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);  | 
389  |  |  | 
390  |  | /* Copy N units from SRC to DEST, guaranteeing correct behavior for  | 
391  |  |    overlapping memory areas.  */  | 
392  |  | /* Similar to memmove().  */  | 
393  |  | extern uint8_t *  | 
394  |  |        u8_move (uint8_t *dest, const uint8_t *src, size_t n);  | 
395  |  | extern uint16_t *  | 
396  |  |        u16_move (uint16_t *dest, const uint16_t *src, size_t n);  | 
397  |  | extern uint32_t *  | 
398  |  |        u32_move (uint32_t *dest, const uint32_t *src, size_t n);  | 
399  |  |  | 
400  |  | /* Set the first N characters of S to UC.  UC should be a character that  | 
401  |  |    occupies only 1 unit.  */  | 
402  |  | /* Similar to memset().  */  | 
403  |  | extern uint8_t *  | 
404  |  |        u8_set (uint8_t *s, ucs4_t uc, size_t n);  | 
405  |  | extern uint16_t *  | 
406  |  |        u16_set (uint16_t *s, ucs4_t uc, size_t n);  | 
407  |  | extern uint32_t *  | 
408  |  |        u32_set (uint32_t *s, ucs4_t uc, size_t n);  | 
409  |  |  | 
410  |  | /* Compare S1 and S2, each of length N.  */  | 
411  |  | /* Similar to memcmp().  */  | 
412  |  | extern int  | 
413  |  |        u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n)  | 
414  |  |        _UC_ATTRIBUTE_PURE;  | 
415  |  | extern int  | 
416  |  |        u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n)  | 
417  |  |        _UC_ATTRIBUTE_PURE;  | 
418  |  | extern int  | 
419  |  |        u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n)  | 
420  |  |        _UC_ATTRIBUTE_PURE;  | 
421  |  |  | 
422  |  | /* Compare S1 and S2.  */  | 
423  |  | /* Similar to the gnulib function memcmp2().  */  | 
424  |  | extern int  | 
425  |  |        u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2)  | 
426  |  |        _UC_ATTRIBUTE_PURE;  | 
427  |  | extern int  | 
428  |  |        u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2)  | 
429  |  |        _UC_ATTRIBUTE_PURE;  | 
430  |  | extern int  | 
431  |  |        u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2)  | 
432  |  |        _UC_ATTRIBUTE_PURE;  | 
433  |  |  | 
434  |  | /* Search the string at S for UC.  */  | 
435  |  | /* Similar to memchr().  */  | 
436  |  | extern uint8_t *  | 
437  |  |        u8_chr (const uint8_t *s, size_t n, ucs4_t uc)  | 
438  |  |        _UC_ATTRIBUTE_PURE;  | 
439  |  | extern uint16_t *  | 
440  |  |        u16_chr (const uint16_t *s, size_t n, ucs4_t uc)  | 
441  |  |        _UC_ATTRIBUTE_PURE;  | 
442  |  | extern uint32_t *  | 
443  |  |        u32_chr (const uint32_t *s, size_t n, ucs4_t uc)  | 
444  |  |        _UC_ATTRIBUTE_PURE;  | 
445  |  |  | 
446  |  | /* Count the number of Unicode characters in the N units from S.  */  | 
447  |  | /* Similar to mbsnlen().  */  | 
448  |  | extern size_t  | 
449  |  |        u8_mbsnlen (const uint8_t *s, size_t n)  | 
450  |  |        _UC_ATTRIBUTE_PURE;  | 
451  |  | extern size_t  | 
452  |  |        u16_mbsnlen (const uint16_t *s, size_t n)  | 
453  |  |        _UC_ATTRIBUTE_PURE;  | 
454  |  | extern size_t  | 
455  |  |        u32_mbsnlen (const uint32_t *s, size_t n)  | 
456  |  |        _UC_ATTRIBUTE_PURE;  | 
457  |  |  | 
458  |  | /* Elementary string functions with memory allocation.  */  | 
459  |  |  | 
460  |  | /* Make a freshly allocated copy of S, of length N.  */  | 
461  |  | extern uint8_t *  | 
462  |  |        u8_cpy_alloc (const uint8_t *s, size_t n);  | 
463  |  | extern uint16_t *  | 
464  |  |        u16_cpy_alloc (const uint16_t *s, size_t n);  | 
465  |  | extern uint32_t *  | 
466  |  |        u32_cpy_alloc (const uint32_t *s, size_t n);  | 
467  |  |  | 
468  |  | /* Elementary string functions on NUL terminated strings.  */  | 
469  |  |  | 
470  |  | /* Return the length (number of units) of the first character in S.  | 
471  |  |    Return 0 if it is the NUL character.  Return -1 upon failure.  */  | 
472  |  | extern int  | 
473  |  |        u8_strmblen (const uint8_t *s)  | 
474  |  |        _UC_ATTRIBUTE_PURE;  | 
475  |  | extern int  | 
476  |  |        u16_strmblen (const uint16_t *s)  | 
477  |  |        _UC_ATTRIBUTE_PURE;  | 
478  |  | extern int  | 
479  |  |        u32_strmblen (const uint32_t *s)  | 
480  |  |        _UC_ATTRIBUTE_PURE;  | 
481  |  |  | 
482  |  | /* Return the length (number of units) of the first character in S, putting  | 
483  |  |    its 'ucs4_t' representation in *PUC.  Return 0 if it is the NUL  | 
484  |  |    character.  Return -1 upon failure.  */  | 
485  |  | extern int  | 
486  |  |        u8_strmbtouc (ucs4_t *puc, const uint8_t *s);  | 
487  |  | extern int  | 
488  |  |        u16_strmbtouc (ucs4_t *puc, const uint16_t *s);  | 
489  |  | extern int  | 
490  |  |        u32_strmbtouc (ucs4_t *puc, const uint32_t *s);  | 
491  |  |  | 
492  |  | /* Forward iteration step.  Advances the pointer past the next character,  | 
493  |  |    or returns NULL if the end of the string has been reached.  Puts the  | 
494  |  |    character's 'ucs4_t' representation in *PUC.  */  | 
495  |  | extern const uint8_t *  | 
496  |  |        u8_next (ucs4_t *puc, const uint8_t *s);  | 
497  |  | extern const uint16_t *  | 
498  |  |        u16_next (ucs4_t *puc, const uint16_t *s);  | 
499  |  | extern const uint32_t *  | 
500  |  |        u32_next (ucs4_t *puc, const uint32_t *s);  | 
501  |  |  | 
502  |  | /* Backward iteration step.  Advances the pointer to point to the previous  | 
503  |  |    character, or returns NULL if the beginning of the string had been reached.  | 
504  |  |    Puts the character's 'ucs4_t' representation in *PUC.  */  | 
505  |  | extern const uint8_t *  | 
506  |  |        u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start);  | 
507  |  | extern const uint16_t *  | 
508  |  |        u16_prev (ucs4_t *puc, const uint16_t *s, const uint16_t *start);  | 
509  |  | extern const uint32_t *  | 
510  |  |        u32_prev (ucs4_t *puc, const uint32_t *s, const uint32_t *start);  | 
511  |  |  | 
512  |  | /* Return the number of units in S.  */  | 
513  |  | /* Similar to strlen(), wcslen().  */  | 
514  |  | extern size_t  | 
515  |  |        u8_strlen (const uint8_t *s)  | 
516  |  |        _UC_ATTRIBUTE_PURE;  | 
517  |  | extern size_t  | 
518  |  |        u16_strlen (const uint16_t *s)  | 
519  |  |        _UC_ATTRIBUTE_PURE;  | 
520  |  | extern size_t  | 
521  |  |        u32_strlen (const uint32_t *s)  | 
522  |  |        _UC_ATTRIBUTE_PURE;  | 
523  |  |  | 
524  |  | /* Return the number of units in S, but at most MAXLEN.  */  | 
525  |  | /* Similar to strnlen(), wcsnlen().  */  | 
526  |  | extern size_t  | 
527  |  |        u8_strnlen (const uint8_t *s, size_t maxlen)  | 
528  |  |        _UC_ATTRIBUTE_PURE;  | 
529  |  | extern size_t  | 
530  |  |        u16_strnlen (const uint16_t *s, size_t maxlen)  | 
531  |  |        _UC_ATTRIBUTE_PURE;  | 
532  |  | extern size_t  | 
533  |  |        u32_strnlen (const uint32_t *s, size_t maxlen)  | 
534  |  |        _UC_ATTRIBUTE_PURE;  | 
535  |  |  | 
536  |  | /* Copy SRC to DEST.  */  | 
537  |  | /* Similar to strcpy(), wcscpy().  */  | 
538  |  | extern uint8_t *  | 
539  |  |        u8_strcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src);  | 
540  |  | extern uint16_t *  | 
541  |  |        u16_strcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src);  | 
542  |  | extern uint32_t *  | 
543  |  |        u32_strcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src);  | 
544  |  |  | 
545  |  | /* Copy SRC to DEST, returning the address of the terminating NUL in DEST.  */  | 
546  |  | /* Similar to stpcpy().  */  | 
547  |  | extern uint8_t *  | 
548  |  |        u8_stpcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src);  | 
549  |  | extern uint16_t *  | 
550  |  |        u16_stpcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src);  | 
551  |  | extern uint32_t *  | 
552  |  |        u32_stpcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src);  | 
553  |  |  | 
554  |  | /* Copy no more than N units of SRC to DEST.  */  | 
555  |  | /* Similar to strncpy(), wcsncpy().  */  | 
556  |  | extern uint8_t *  | 
557  |  |        u8_strncpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);  | 
558  |  | extern uint16_t *  | 
559  |  |        u16_strncpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);  | 
560  |  | extern uint32_t *  | 
561  |  |        u32_strncpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);  | 
562  |  |  | 
563  |  | /* Copy no more than N units of SRC to DEST.  Return a pointer past the last  | 
564  |  |    non-NUL unit written into DEST.  */  | 
565  |  | /* Similar to stpncpy().  */  | 
566  |  | extern uint8_t *  | 
567  |  |        u8_stpncpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);  | 
568  |  | extern uint16_t *  | 
569  |  |        u16_stpncpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);  | 
570  |  | extern uint32_t *  | 
571  |  |        u32_stpncpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);  | 
572  |  |  | 
573  |  | /* Append SRC onto DEST.  */  | 
574  |  | /* Similar to strcat(), wcscat().  */  | 
575  |  | extern uint8_t *  | 
576  |  |        u8_strcat (uint8_t *_UC_RESTRICT dest, const uint8_t *src);  | 
577  |  | extern uint16_t *  | 
578  |  |        u16_strcat (uint16_t *_UC_RESTRICT dest, const uint16_t *src);  | 
579  |  | extern uint32_t *  | 
580  |  |        u32_strcat (uint32_t *_UC_RESTRICT dest, const uint32_t *src);  | 
581  |  |  | 
582  |  | /* Append no more than N units of SRC onto DEST.  */  | 
583  |  | /* Similar to strncat(), wcsncat().  */  | 
584  |  | extern uint8_t *  | 
585  |  |        u8_strncat (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);  | 
586  |  | extern uint16_t *  | 
587  |  |        u16_strncat (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);  | 
588  |  | extern uint32_t *  | 
589  |  |        u32_strncat (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);  | 
590  |  |  | 
591  |  | /* Compare S1 and S2.  */  | 
592  |  | /* Similar to strcmp(), wcscmp().  */  | 
593  |  | #ifdef __sun  | 
594  |  | /* Avoid a collision with the u8_strcmp() function in Solaris 11 libc.  */  | 
595  |  | extern int  | 
596  |  |        u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2)  | 
597  |  |        _UC_ATTRIBUTE_PURE;  | 
598  |  | # define u8_strcmp u8_strcmp_gnu  | 
599  |  | #else  | 
600  |  | extern int  | 
601  |  |        u8_strcmp (const uint8_t *s1, const uint8_t *s2)  | 
602  |  |        _UC_ATTRIBUTE_PURE;  | 
603  |  | #endif  | 
604  |  | extern int  | 
605  |  |        u16_strcmp (const uint16_t *s1, const uint16_t *s2)  | 
606  |  |        _UC_ATTRIBUTE_PURE;  | 
607  |  | extern int  | 
608  |  |        u32_strcmp (const uint32_t *s1, const uint32_t *s2)  | 
609  |  |        _UC_ATTRIBUTE_PURE;  | 
610  |  |  | 
611  |  | /* Compare S1 and S2 using the collation rules of the current locale.  | 
612  |  |    Return -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2.  | 
613  |  |    Upon failure, set errno and return any value.  */  | 
614  |  | /* Similar to strcoll(), wcscoll().  */  | 
615  |  | extern int  | 
616  |  |        u8_strcoll (const uint8_t *s1, const uint8_t *s2);  | 
617  |  | extern int  | 
618  |  |        u16_strcoll (const uint16_t *s1, const uint16_t *s2);  | 
619  |  | extern int  | 
620  |  |        u32_strcoll (const uint32_t *s1, const uint32_t *s2);  | 
621  |  |  | 
622  |  | /* Compare no more than N units of S1 and S2.  */  | 
623  |  | /* Similar to strncmp(), wcsncmp().  */  | 
624  |  | extern int  | 
625  |  |        u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n)  | 
626  |  |        _UC_ATTRIBUTE_PURE;  | 
627  |  | extern int  | 
628  |  |        u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n)  | 
629  |  |        _UC_ATTRIBUTE_PURE;  | 
630  |  | extern int  | 
631  |  |        u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n)  | 
632  |  |        _UC_ATTRIBUTE_PURE;  | 
633  |  |  | 
634  |  | /* Duplicate S, returning an identical malloc'd string.  */  | 
635  |  | /* Similar to strdup(), wcsdup().  */  | 
636  |  | extern uint8_t *  | 
637  |  |        u8_strdup (const uint8_t *s)  | 
638  |  |        _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;  | 
639  |  | extern uint16_t *  | 
640  |  |        u16_strdup (const uint16_t *s)  | 
641  |  |        _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;  | 
642  |  | extern uint32_t *  | 
643  |  |        u32_strdup (const uint32_t *s)  | 
644  |  |        _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;  | 
645  |  |  | 
646  |  | /* Find the first occurrence of UC in STR.  */  | 
647  |  | /* Similar to strchr(), wcschr().  */  | 
648  |  | extern uint8_t *  | 
649  |  |        u8_strchr (const uint8_t *str, ucs4_t uc)  | 
650  |  |        _UC_ATTRIBUTE_PURE;  | 
651  |  | extern uint16_t *  | 
652  |  |        u16_strchr (const uint16_t *str, ucs4_t uc)  | 
653  |  |        _UC_ATTRIBUTE_PURE;  | 
654  |  | extern uint32_t *  | 
655  |  |        u32_strchr (const uint32_t *str, ucs4_t uc)  | 
656  |  |        _UC_ATTRIBUTE_PURE;  | 
657  |  |  | 
658  |  | /* Find the last occurrence of UC in STR.  */  | 
659  |  | /* Similar to strrchr(), wcsrchr().  */  | 
660  |  | extern uint8_t *  | 
661  |  |        u8_strrchr (const uint8_t *str, ucs4_t uc)  | 
662  |  |        _UC_ATTRIBUTE_PURE;  | 
663  |  | extern uint16_t *  | 
664  |  |        u16_strrchr (const uint16_t *str, ucs4_t uc)  | 
665  |  |        _UC_ATTRIBUTE_PURE;  | 
666  |  | extern uint32_t *  | 
667  |  |        u32_strrchr (const uint32_t *str, ucs4_t uc)  | 
668  |  |        _UC_ATTRIBUTE_PURE;  | 
669  |  |  | 
670  |  | /* Return the length of the initial segment of STR which consists entirely  | 
671  |  |    of Unicode characters not in REJECT.  */  | 
672  |  | /* Similar to strcspn(), wcscspn().  */  | 
673  |  | extern size_t  | 
674  |  |        u8_strcspn (const uint8_t *str, const uint8_t *reject)  | 
675  |  |        _UC_ATTRIBUTE_PURE;  | 
676  |  | extern size_t  | 
677  |  |        u16_strcspn (const uint16_t *str, const uint16_t *reject)  | 
678  |  |        _UC_ATTRIBUTE_PURE;  | 
679  |  | extern size_t  | 
680  |  |        u32_strcspn (const uint32_t *str, const uint32_t *reject)  | 
681  |  |        _UC_ATTRIBUTE_PURE;  | 
682  |  |  | 
683  |  | /* Return the length of the initial segment of STR which consists entirely  | 
684  |  |    of Unicode characters in ACCEPT.  */  | 
685  |  | /* Similar to strspn(), wcsspn().  */  | 
686  |  | extern size_t  | 
687  |  |        u8_strspn (const uint8_t *str, const uint8_t *accept)  | 
688  |  |        _UC_ATTRIBUTE_PURE;  | 
689  |  | extern size_t  | 
690  |  |        u16_strspn (const uint16_t *str, const uint16_t *accept)  | 
691  |  |        _UC_ATTRIBUTE_PURE;  | 
692  |  | extern size_t  | 
693  |  |        u32_strspn (const uint32_t *str, const uint32_t *accept)  | 
694  |  |        _UC_ATTRIBUTE_PURE;  | 
695  |  |  | 
696  |  | /* Find the first occurrence in STR of any character in ACCEPT.  */  | 
697  |  | /* Similar to strpbrk(), wcspbrk().  */  | 
698  |  | extern uint8_t *  | 
699  |  |        u8_strpbrk (const uint8_t *str, const uint8_t *accept)  | 
700  |  |        _UC_ATTRIBUTE_PURE;  | 
701  |  | extern uint16_t *  | 
702  |  |        u16_strpbrk (const uint16_t *str, const uint16_t *accept)  | 
703  |  |        _UC_ATTRIBUTE_PURE;  | 
704  |  | extern uint32_t *  | 
705  |  |        u32_strpbrk (const uint32_t *str, const uint32_t *accept)  | 
706  |  |        _UC_ATTRIBUTE_PURE;  | 
707  |  |  | 
708  |  | /* Find the first occurrence of NEEDLE in HAYSTACK.  */  | 
709  |  | /* Similar to strstr(), wcsstr().  */  | 
710  |  | extern uint8_t *  | 
711  |  |        u8_strstr (const uint8_t *haystack, const uint8_t *needle)  | 
712  |  |        _UC_ATTRIBUTE_PURE;  | 
713  |  | extern uint16_t *  | 
714  |  |        u16_strstr (const uint16_t *haystack, const uint16_t *needle)  | 
715  |  |        _UC_ATTRIBUTE_PURE;  | 
716  |  | extern uint32_t *  | 
717  |  |        u32_strstr (const uint32_t *haystack, const uint32_t *needle)  | 
718  |  |        _UC_ATTRIBUTE_PURE;  | 
719  |  |  | 
720  |  | /* Test whether STR starts with PREFIX.  */  | 
721  |  | extern bool  | 
722  |  |        u8_startswith (const uint8_t *str, const uint8_t *prefix)  | 
723  |  |        _UC_ATTRIBUTE_PURE;  | 
724  |  | extern bool  | 
725  |  |        u16_startswith (const uint16_t *str, const uint16_t *prefix)  | 
726  |  |        _UC_ATTRIBUTE_PURE;  | 
727  |  | extern bool  | 
728  |  |        u32_startswith (const uint32_t *str, const uint32_t *prefix)  | 
729  |  |        _UC_ATTRIBUTE_PURE;  | 
730  |  |  | 
731  |  | /* Test whether STR ends with SUFFIX.  */  | 
732  |  | extern bool  | 
733  |  |        u8_endswith (const uint8_t *str, const uint8_t *suffix)  | 
734  |  |        _UC_ATTRIBUTE_PURE;  | 
735  |  | extern bool  | 
736  |  |        u16_endswith (const uint16_t *str, const uint16_t *suffix)  | 
737  |  |        _UC_ATTRIBUTE_PURE;  | 
738  |  | extern bool  | 
739  |  |        u32_endswith (const uint32_t *str, const uint32_t *suffix)  | 
740  |  |        _UC_ATTRIBUTE_PURE;  | 
741  |  |  | 
742  |  | /* Divide STR into tokens separated by characters in DELIM.  | 
743  |  |    This interface is actually more similar to wcstok than to strtok.  */  | 
744  |  | /* Similar to strtok_r(), wcstok().  */  | 
745  |  | extern uint8_t *  | 
746  |  |        u8_strtok (uint8_t *_UC_RESTRICT str, const uint8_t *delim,  | 
747  |  |                   uint8_t **ptr);  | 
748  |  | extern uint16_t *  | 
749  |  |        u16_strtok (uint16_t *_UC_RESTRICT str, const uint16_t *delim,  | 
750  |  |                    uint16_t **ptr);  | 
751  |  | extern uint32_t *  | 
752  |  |        u32_strtok (uint32_t *_UC_RESTRICT str, const uint32_t *delim,  | 
753  |  |                    uint32_t **ptr);  | 
754  |  |  | 
755  |  |  | 
756  |  | #ifdef __cplusplus  | 
757  |  | }  | 
758  |  | #endif  | 
759  |  |  | 
760  |  | #endif /* _UNISTR_H */  |