Line | Count | Source |
1 | | #ifndef HEADER_CURL_STRCASE_H |
2 | | #define HEADER_CURL_STRCASE_H |
3 | | /*************************************************************************** |
4 | | * _ _ ____ _ |
5 | | * Project ___| | | | _ \| | |
6 | | * / __| | | | |_) | | |
7 | | * | (__| |_| | _ <| |___ |
8 | | * \___|\___/|_| \_\_____| |
9 | | * |
10 | | * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. |
11 | | * |
12 | | * This software is licensed as described in the file COPYING, which |
13 | | * you should have received as part of this distribution. The terms |
14 | | * are also available at https://curl.se/docs/copyright.html. |
15 | | * |
16 | | * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
17 | | * copies of the Software, and permit persons to whom the Software is |
18 | | * furnished to do so, under the terms of the COPYING file. |
19 | | * |
20 | | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
21 | | * KIND, either express or implied. |
22 | | * |
23 | | * SPDX-License-Identifier: curl |
24 | | * |
25 | | ***************************************************************************/ |
26 | | #include "curl_setup.h" |
27 | | |
28 | | /* Mapping tables for plain ASCII case conversion, defined in strcase.c. |
29 | | Declared here so the conversions below inline at every call site without |
30 | | relying on LTO or a unity build: casecompare() invokes one of them twice |
31 | | per byte compared, where the call costs more than the lookup itself. */ |
32 | | extern const unsigned char Curl_touppermap[256]; |
33 | | extern const unsigned char Curl_tolowermap[256]; |
34 | | |
35 | | /* Portable, consistent toupper/tolower. Do not use toupper()/tolower() from |
36 | | <ctype.h>, whose behavior is altered by the current locale. */ |
37 | | static CURL_INLINE char Curl_raw_toupper(char in) |
38 | 18.3k | { |
39 | 18.3k | return (char)Curl_touppermap[(unsigned char)in]; |
40 | 18.3k | } Unexecuted instantiation: urlapi.c:Curl_raw_toupper Unexecuted instantiation: protocol.c:Curl_raw_toupper Unexecuted instantiation: rtsp.c:Curl_raw_toupper Unexecuted instantiation: strcase.c:Curl_raw_toupper strequal.c:Curl_raw_toupper Line | Count | Source | 38 | 18.3k | { | 39 | 18.3k | return (char)Curl_touppermap[(unsigned char)in]; | 40 | 18.3k | } |
Unexecuted instantiation: tftp.c:Curl_raw_toupper Unexecuted instantiation: url.c:Curl_raw_toupper Unexecuted instantiation: dnscache.c:Curl_raw_toupper Unexecuted instantiation: hostip.c:Curl_raw_toupper Unexecuted instantiation: vtls.c:Curl_raw_toupper Unexecuted instantiation: vtls_config.c:Curl_raw_toupper Unexecuted instantiation: vtls_scache.c:Curl_raw_toupper Unexecuted instantiation: cookie.c:Curl_raw_toupper Unexecuted instantiation: creds.c:Curl_raw_toupper Unexecuted instantiation: ftp.c:Curl_raw_toupper Unexecuted instantiation: http.c:Curl_raw_toupper Unexecuted instantiation: http_aws_sigv4.c:Curl_raw_toupper Unexecuted instantiation: http_digest.c:Curl_raw_toupper Unexecuted instantiation: imap.c:Curl_raw_toupper Unexecuted instantiation: netrc.c:Curl_raw_toupper Unexecuted instantiation: openldap.c:Curl_raw_toupper Unexecuted instantiation: proxy.c:Curl_raw_toupper Unexecuted instantiation: setopt.c:Curl_raw_toupper Unexecuted instantiation: cf-h1-proxy.c:Curl_raw_toupper Unexecuted instantiation: dynhds.c:Curl_raw_toupper |
41 | | |
42 | | static CURL_INLINE char Curl_raw_tolower(char in) |
43 | 5.82k | { |
44 | 5.82k | return (char)Curl_tolowermap[(unsigned char)in]; |
45 | 5.82k | } urlapi.c:Curl_raw_tolower Line | Count | Source | 43 | 724 | { | 44 | 724 | return (char)Curl_tolowermap[(unsigned char)in]; | 45 | 724 | } |
protocol.c:Curl_raw_tolower Line | Count | Source | 43 | 2.16k | { | 44 | 2.16k | return (char)Curl_tolowermap[(unsigned char)in]; | 45 | 2.16k | } |
Unexecuted instantiation: rtsp.c:Curl_raw_tolower strcase.c:Curl_raw_tolower Line | Count | Source | 43 | 2.93k | { | 44 | 2.93k | return (char)Curl_tolowermap[(unsigned char)in]; | 45 | 2.93k | } |
Unexecuted instantiation: strequal.c:Curl_raw_tolower Unexecuted instantiation: tftp.c:Curl_raw_tolower Unexecuted instantiation: url.c:Curl_raw_tolower Unexecuted instantiation: dnscache.c:Curl_raw_tolower Unexecuted instantiation: hostip.c:Curl_raw_tolower Unexecuted instantiation: vtls.c:Curl_raw_tolower Unexecuted instantiation: vtls_config.c:Curl_raw_tolower Unexecuted instantiation: vtls_scache.c:Curl_raw_tolower Unexecuted instantiation: cookie.c:Curl_raw_tolower Unexecuted instantiation: creds.c:Curl_raw_tolower Unexecuted instantiation: ftp.c:Curl_raw_tolower Unexecuted instantiation: http.c:Curl_raw_tolower Unexecuted instantiation: http_aws_sigv4.c:Curl_raw_tolower Unexecuted instantiation: http_digest.c:Curl_raw_tolower Unexecuted instantiation: imap.c:Curl_raw_tolower Unexecuted instantiation: netrc.c:Curl_raw_tolower Unexecuted instantiation: openldap.c:Curl_raw_tolower Unexecuted instantiation: proxy.c:Curl_raw_tolower Unexecuted instantiation: setopt.c:Curl_raw_tolower Unexecuted instantiation: cf-h1-proxy.c:Curl_raw_tolower Unexecuted instantiation: dynhds.c:Curl_raw_tolower |
46 | | |
47 | | /* checkprefix() is a shorter version of the above, used when the first |
48 | | argument is the string literal */ |
49 | 8.88k | #define checkprefix(a, b) curl_strnequal(b, STRCONST(a)) |
50 | | |
51 | | void Curl_strntoupper(char *dest, const char *src, size_t n); |
52 | | void Curl_strntolower(char *dest, const char *src, size_t n); |
53 | | |
54 | | bool Curl_safecmp(const char *a, const char *b); |
55 | | int Curl_timestrcmp(const char *a, const char *b); |
56 | | |
57 | | #endif /* HEADER_CURL_STRCASE_H */ |