/src/dovecot/src/lib/strfuncs.h
Line | Count | Source |
1 | | #ifndef STRFUNC_H |
2 | | #define STRFUNC_H |
3 | | |
4 | | /* Maximum number of bytes needed for the largest uintmax_t or the lowest |
5 | | intmax_t number in base 10. This value includes the trailing \0. */ |
6 | 0 | #define MAX_INT_STRLEN ((sizeof(uintmax_t) * CHAR_BIT + 2) / 3 + 1) |
7 | | |
8 | | /* Linear whitespace: space and tab. */ |
9 | | #define STRFUNCS_LWSP " \t" |
10 | | |
11 | | extern const unsigned char uchar_nul; /* (const unsigned char *)"" */ |
12 | | extern const unsigned char *uchar_empty_ptr; /* non-NULL pointer that shouldn't be dereferenced. */ |
13 | | extern const char *const empty_str_array[]; |
14 | | |
15 | | /* Returns -1 if dest wasn't large enough, 0 if not. */ |
16 | | int i_snprintf(char *dest, size_t max_chars, const char *format, ...) |
17 | | ATTR_FORMAT(3, 4); |
18 | | |
19 | | /* The p_/t_/i_ strdup, strconcat and *printf helpers below preserve errno. |
20 | | So this pattern is safe - errno still refers to the failed syscall when |
21 | | "%m" is expanded: |
22 | | |
23 | | if (syscall(...) < 0) |
24 | | error = t_strdup_printf("syscall() failed: %m"); */ |
25 | | |
26 | | char *p_strdup(pool_t pool, const char *str) ATTR_MALLOC; |
27 | | void *p_memdup(pool_t pool, const void *data, size_t size) ATTR_MALLOC; |
28 | | /* return NULL if str = "" */ |
29 | | char *p_strdup_empty(pool_t pool, const char *str) ATTR_MALLOC; |
30 | | /* *end isn't included */ |
31 | | char *p_strdup_until(pool_t pool, const void *start, const void *end) |
32 | | ATTR_MALLOC ATTR_RETURNS_NONNULL; |
33 | | char *p_strndup(pool_t pool, const void *str, size_t max_chars) ATTR_MALLOC; |
34 | | char *p_strdup_printf(pool_t pool, const char *format, ...) |
35 | | ATTR_FORMAT(2, 3) ATTR_MALLOC ATTR_RETURNS_NONNULL; |
36 | | char *p_strdup_vprintf(pool_t pool, const char *format, va_list args) |
37 | | ATTR_FORMAT(2, 0) ATTR_MALLOC ATTR_RETURNS_NONNULL; |
38 | | char *p_strconcat(pool_t pool, const char *str1, ...) |
39 | | ATTR_SENTINEL ATTR_MALLOC; |
40 | | |
41 | | /* same with temporary memory allocations: */ |
42 | | const char *t_strdup(const char *str) ATTR_MALLOC; |
43 | | char *t_strdup_noconst(const char *str) ATTR_MALLOC; |
44 | | const void *t_memdup(const void *data, size_t size) ATTR_MALLOC; |
45 | | void *t_memdup_noconst(const void *data, size_t size) ATTR_MALLOC; |
46 | | /* return NULL if str = "" */ |
47 | | const char *t_strdup_empty(const char *str) ATTR_MALLOC; |
48 | | /* *end isn't included */ |
49 | | const char *t_strdup_until(const void *start, const void *end) |
50 | | ATTR_MALLOC ATTR_RETURNS_NONNULL; |
51 | | char *t_strdup_until_noconst(const void *start, const void *end) |
52 | | ATTR_MALLOC ATTR_RETURNS_NONNULL; |
53 | | const char *t_strndup(const void *str, size_t max_chars) ATTR_MALLOC; |
54 | | const char *t_strdup_printf(const char *format, ...) |
55 | | ATTR_FORMAT(1, 2) ATTR_MALLOC ATTR_RETURNS_NONNULL; |
56 | | const char *t_strdup_vprintf(const char *format, va_list args) |
57 | | ATTR_FORMAT(1, 0) ATTR_MALLOC ATTR_RETURNS_NONNULL; |
58 | | const char *t_strconcat(const char *str1, ...) |
59 | | ATTR_SENTINEL ATTR_MALLOC; |
60 | | |
61 | | /* Like t_strdup(), but stop at cutchar. */ |
62 | | const char *t_strcut(const char *str, char cutchar); |
63 | | /* Replace all from->to chars in the string. */ |
64 | | const char *t_str_replace(const char *str, char from, char to); |
65 | | /* Put the string on a single line by replacing all newlines with spaces and |
66 | | dropping any carriage returns. Sequences of several newlines are merged into |
67 | | one space and newlines at the beginning and end of the string are dropped. */ |
68 | | const char *t_str_oneline(const char *str); |
69 | | |
70 | | /* Like strlcpy(), but return -1 if buffer was overflown, 0 if not. */ |
71 | | int i_strocpy(char *dest, const char *src, size_t dstsize); |
72 | | |
73 | | char *str_ucase(char *str); |
74 | | char *str_lcase(char *str); |
75 | | const char *t_str_lcase(const char *str); |
76 | | const char *t_str_ucase(const char *str); |
77 | | |
78 | | /* Return pointer to first matching needle */ |
79 | | const char *i_strstr_arr(const char *haystack, const char *const *needles); |
80 | | |
81 | | /* Trim matching chars from either side of the string */ |
82 | | const char *t_str_trim(const char *str, const char *chars); |
83 | | const char *p_str_trim(pool_t pool, const char *str, const char *chars); |
84 | | const char *str_ltrim(const char *str, const char *chars); |
85 | | const char *t_str_ltrim(const char *str, const char *chars); |
86 | | const char *p_str_ltrim(pool_t pool, const char *str, const char *chars); |
87 | | const char *t_str_rtrim(const char *str, const char *chars); |
88 | | const char *p_str_rtrim(pool_t pool, const char *str, const char *chars); |
89 | | |
90 | | static inline const char *str_skip_lwsp(const char *str) |
91 | 0 | { |
92 | 0 | return str_ltrim(str, STRFUNCS_LWSP); |
93 | 0 | } Unexecuted instantiation: fuzz-json-istream.c:str_skip_lwsp Unexecuted instantiation: json-tree.c:str_skip_lwsp Unexecuted instantiation: json-istream.c:str_skip_lwsp Unexecuted instantiation: json-parser.c:str_skip_lwsp Unexecuted instantiation: istream-json-string.c:str_skip_lwsp Unexecuted instantiation: json-syntax.c:str_skip_lwsp Unexecuted instantiation: fuzzer.c:str_skip_lwsp Unexecuted instantiation: test-istream.c:str_skip_lwsp Unexecuted instantiation: array.c:str_skip_lwsp Unexecuted instantiation: buffer.c:str_skip_lwsp Unexecuted instantiation: data-stack.c:str_skip_lwsp Unexecuted instantiation: event-log.c:str_skip_lwsp Unexecuted instantiation: failures.c:str_skip_lwsp Unexecuted instantiation: fd-util.c:str_skip_lwsp Unexecuted instantiation: hostpid.c:str_skip_lwsp Unexecuted instantiation: imem.c:str_skip_lwsp Unexecuted instantiation: iostream.c:str_skip_lwsp Unexecuted instantiation: iostream-pump.c:str_skip_lwsp Unexecuted instantiation: istream.c:str_skip_lwsp Unexecuted instantiation: istream-data.c:str_skip_lwsp Unexecuted instantiation: istream-file.c:str_skip_lwsp Unexecuted instantiation: istream-limit.c:str_skip_lwsp Unexecuted instantiation: istream-seekable.c:str_skip_lwsp Unexecuted instantiation: ioloop.c:str_skip_lwsp Unexecuted instantiation: ioloop-notify-inotify.c:str_skip_lwsp Unexecuted instantiation: ioloop-epoll.c:str_skip_lwsp Unexecuted instantiation: lib.c:str_skip_lwsp Unexecuted instantiation: lib-event.c:str_skip_lwsp Unexecuted instantiation: lib-signals.c:str_skip_lwsp Unexecuted instantiation: memarea.c:str_skip_lwsp Unexecuted instantiation: mempool.c:str_skip_lwsp Unexecuted instantiation: mempool-alloconly.c:str_skip_lwsp Unexecuted instantiation: mempool-datastack.c:str_skip_lwsp Unexecuted instantiation: mempool-system.c:str_skip_lwsp Unexecuted instantiation: mempool-unsafe-datastack.c:str_skip_lwsp Unexecuted instantiation: net.c:str_skip_lwsp Unexecuted instantiation: ostream.c:str_skip_lwsp Unexecuted instantiation: ostream-file.c:str_skip_lwsp Unexecuted instantiation: path-util.c:str_skip_lwsp Unexecuted instantiation: printf-format-fix.c:str_skip_lwsp Unexecuted instantiation: process-title.c:str_skip_lwsp Unexecuted instantiation: priorityq.c:str_skip_lwsp Unexecuted instantiation: randgen.c:str_skip_lwsp Unexecuted instantiation: rand.c:str_skip_lwsp Unexecuted instantiation: read-full.c:str_skip_lwsp Unexecuted instantiation: restrict-access.c:str_skip_lwsp Unexecuted instantiation: safe-memset.c:str_skip_lwsp Unexecuted instantiation: safe-mkstemp.c:str_skip_lwsp Unexecuted instantiation: sendfile-util.c:str_skip_lwsp Unexecuted instantiation: sleep.c:str_skip_lwsp Unexecuted instantiation: str.c:str_skip_lwsp Unexecuted instantiation: strescape.c:str_skip_lwsp Unexecuted instantiation: strfuncs.c:str_skip_lwsp Unexecuted instantiation: strnum.c:str_skip_lwsp Unexecuted instantiation: time-util.c:str_skip_lwsp Unexecuted instantiation: unichar.c:str_skip_lwsp Unexecuted instantiation: unicode-break.c:str_skip_lwsp Unexecuted instantiation: unicode-data-tables.c:str_skip_lwsp Unexecuted instantiation: unicode-transform.c:str_skip_lwsp Unexecuted instantiation: write-full.c:str_skip_lwsp Unexecuted instantiation: backtrace-string.c:str_skip_lwsp Unexecuted instantiation: bits.c:str_skip_lwsp Unexecuted instantiation: eacces-error.c:str_skip_lwsp Unexecuted instantiation: env-util.c:str_skip_lwsp Unexecuted instantiation: event-filter.c:str_skip_lwsp Unexecuted instantiation: event-filter-lexer.c:str_skip_lwsp Unexecuted instantiation: event-filter-parser.c:str_skip_lwsp Unexecuted instantiation: hash.c:str_skip_lwsp Unexecuted instantiation: hex-binary.c:str_skip_lwsp Unexecuted instantiation: hmac.c:str_skip_lwsp Unexecuted instantiation: ipwd.c:str_skip_lwsp Unexecuted instantiation: istream-concat.c:str_skip_lwsp Unexecuted instantiation: ioloop-iolist.c:str_skip_lwsp Unexecuted instantiation: ioloop-notify-fd.c:str_skip_lwsp Unexecuted instantiation: primes.c:str_skip_lwsp Unexecuted instantiation: sha2.c:str_skip_lwsp Unexecuted instantiation: xxh64.c:str_skip_lwsp Unexecuted instantiation: str-parse.c:str_skip_lwsp Unexecuted instantiation: wildcard-match.c:str_skip_lwsp |
94 | | |
95 | | static inline const char *str_skip_nonlwsp(const char *str) |
96 | 0 | { |
97 | 0 | return str + strcspn(str, STRFUNCS_LWSP); |
98 | 0 | } Unexecuted instantiation: fuzz-json-istream.c:str_skip_nonlwsp Unexecuted instantiation: json-tree.c:str_skip_nonlwsp Unexecuted instantiation: json-istream.c:str_skip_nonlwsp Unexecuted instantiation: json-parser.c:str_skip_nonlwsp Unexecuted instantiation: istream-json-string.c:str_skip_nonlwsp Unexecuted instantiation: json-syntax.c:str_skip_nonlwsp Unexecuted instantiation: fuzzer.c:str_skip_nonlwsp Unexecuted instantiation: test-istream.c:str_skip_nonlwsp Unexecuted instantiation: array.c:str_skip_nonlwsp Unexecuted instantiation: buffer.c:str_skip_nonlwsp Unexecuted instantiation: data-stack.c:str_skip_nonlwsp Unexecuted instantiation: event-log.c:str_skip_nonlwsp Unexecuted instantiation: failures.c:str_skip_nonlwsp Unexecuted instantiation: fd-util.c:str_skip_nonlwsp Unexecuted instantiation: hostpid.c:str_skip_nonlwsp Unexecuted instantiation: imem.c:str_skip_nonlwsp Unexecuted instantiation: iostream.c:str_skip_nonlwsp Unexecuted instantiation: iostream-pump.c:str_skip_nonlwsp Unexecuted instantiation: istream.c:str_skip_nonlwsp Unexecuted instantiation: istream-data.c:str_skip_nonlwsp Unexecuted instantiation: istream-file.c:str_skip_nonlwsp Unexecuted instantiation: istream-limit.c:str_skip_nonlwsp Unexecuted instantiation: istream-seekable.c:str_skip_nonlwsp Unexecuted instantiation: ioloop.c:str_skip_nonlwsp Unexecuted instantiation: ioloop-notify-inotify.c:str_skip_nonlwsp Unexecuted instantiation: ioloop-epoll.c:str_skip_nonlwsp Unexecuted instantiation: lib.c:str_skip_nonlwsp Unexecuted instantiation: lib-event.c:str_skip_nonlwsp Unexecuted instantiation: lib-signals.c:str_skip_nonlwsp Unexecuted instantiation: memarea.c:str_skip_nonlwsp Unexecuted instantiation: mempool.c:str_skip_nonlwsp Unexecuted instantiation: mempool-alloconly.c:str_skip_nonlwsp Unexecuted instantiation: mempool-datastack.c:str_skip_nonlwsp Unexecuted instantiation: mempool-system.c:str_skip_nonlwsp Unexecuted instantiation: mempool-unsafe-datastack.c:str_skip_nonlwsp Unexecuted instantiation: net.c:str_skip_nonlwsp Unexecuted instantiation: ostream.c:str_skip_nonlwsp Unexecuted instantiation: ostream-file.c:str_skip_nonlwsp Unexecuted instantiation: path-util.c:str_skip_nonlwsp Unexecuted instantiation: printf-format-fix.c:str_skip_nonlwsp Unexecuted instantiation: process-title.c:str_skip_nonlwsp Unexecuted instantiation: priorityq.c:str_skip_nonlwsp Unexecuted instantiation: randgen.c:str_skip_nonlwsp Unexecuted instantiation: rand.c:str_skip_nonlwsp Unexecuted instantiation: read-full.c:str_skip_nonlwsp Unexecuted instantiation: restrict-access.c:str_skip_nonlwsp Unexecuted instantiation: safe-memset.c:str_skip_nonlwsp Unexecuted instantiation: safe-mkstemp.c:str_skip_nonlwsp Unexecuted instantiation: sendfile-util.c:str_skip_nonlwsp Unexecuted instantiation: sleep.c:str_skip_nonlwsp Unexecuted instantiation: str.c:str_skip_nonlwsp Unexecuted instantiation: strescape.c:str_skip_nonlwsp Unexecuted instantiation: strfuncs.c:str_skip_nonlwsp Unexecuted instantiation: strnum.c:str_skip_nonlwsp Unexecuted instantiation: time-util.c:str_skip_nonlwsp Unexecuted instantiation: unichar.c:str_skip_nonlwsp Unexecuted instantiation: unicode-break.c:str_skip_nonlwsp Unexecuted instantiation: unicode-data-tables.c:str_skip_nonlwsp Unexecuted instantiation: unicode-transform.c:str_skip_nonlwsp Unexecuted instantiation: write-full.c:str_skip_nonlwsp Unexecuted instantiation: backtrace-string.c:str_skip_nonlwsp Unexecuted instantiation: bits.c:str_skip_nonlwsp Unexecuted instantiation: eacces-error.c:str_skip_nonlwsp Unexecuted instantiation: env-util.c:str_skip_nonlwsp Unexecuted instantiation: event-filter.c:str_skip_nonlwsp Unexecuted instantiation: event-filter-lexer.c:str_skip_nonlwsp Unexecuted instantiation: event-filter-parser.c:str_skip_nonlwsp Unexecuted instantiation: hash.c:str_skip_nonlwsp Unexecuted instantiation: hex-binary.c:str_skip_nonlwsp Unexecuted instantiation: hmac.c:str_skip_nonlwsp Unexecuted instantiation: ipwd.c:str_skip_nonlwsp Unexecuted instantiation: istream-concat.c:str_skip_nonlwsp Unexecuted instantiation: ioloop-iolist.c:str_skip_nonlwsp Unexecuted instantiation: ioloop-notify-fd.c:str_skip_nonlwsp Unexecuted instantiation: primes.c:str_skip_nonlwsp Unexecuted instantiation: sha2.c:str_skip_nonlwsp Unexecuted instantiation: xxh64.c:str_skip_nonlwsp Unexecuted instantiation: str-parse.c:str_skip_nonlwsp Unexecuted instantiation: wildcard-match.c:str_skip_nonlwsp |
99 | | |
100 | | int null_strcmp(const char *s1, const char *s2) ATTR_PURE; |
101 | | int null_strcasecmp(const char *s1, const char *s2) ATTR_PURE; |
102 | | int i_memcasecmp(const void *p1, const void *p2, size_t size) ATTR_PURE; |
103 | | /* Like memrchr(): return a pointer to the last occurrence of c within the |
104 | | first size bytes of data, or NULL if not found. */ |
105 | | void *i_memrchr(const void *data, int c, size_t size) ATTR_PURE; |
106 | | int i_strcmp_p(const char *const *p1, const char *const *p2) ATTR_PURE; |
107 | | int i_strcasecmp_p(const char *const *p1, const char *const *p2) ATTR_PURE; |
108 | | /* Returns TRUE if the two memory areas are equal. This function is safe |
109 | | against timing attacks, so it compares all the bytes every time. */ |
110 | | bool mem_equals_timing_safe(const void *p1, const void *p2, size_t size); |
111 | | /* Returns TRUE if the two strings are equal. Similar to |
112 | | mem_equals_timing_safe() this function is safe against timing attacks when |
113 | | the string lengths are the same. If not, the length of the secret string may |
114 | | be leaked, but otherwise the contents won't be. */ |
115 | | bool str_equals_timing_almost_safe(const char *s1, const char *s2); |
116 | | /* Returns TRUE if the two strings are equal. Safe against timing attacks: |
117 | | neither the contents nor the length of either string is leaked. |
118 | | Implemented by HMAC-SHA256ing both inputs under a random per-process key |
119 | | and comparing the fixed-length digests. */ |
120 | | bool str_equals_hash_timing_safe(const char *s1, const char *s2); |
121 | | |
122 | | size_t str_match(const char *p1, const char *p2) ATTR_PURE; |
123 | | size_t str_match_icase(const char *p1, const char *p2) ATTR_PURE; |
124 | | bool str_begins(const char *haystack, const char *needle, |
125 | | const char **suffix_r); |
126 | | bool str_begins_icase(const char *haystack, const char *needle, |
127 | | const char **suffix_r); |
128 | | /* Returns TRUE if any component of str, split at any of the delimiters |
129 | | characters, consists solely of one or more dots. For example "..", |
130 | | "a/../b" and "user@.." all match with delimiters "/@". Such a component |
131 | | escapes its parent directory when str is used as part of a path. */ |
132 | | bool str_has_dots_component(const char *str, const char *delimiters) ATTR_PURE; |
133 | | static inline ATTR_PURE bool |
134 | | str_begins_with(const char *haystack, const char *needle) |
135 | 0 | { |
136 | 0 | return needle[str_match(haystack, needle)] == '\0'; |
137 | 0 | } Unexecuted instantiation: fuzz-json-istream.c:str_begins_with Unexecuted instantiation: json-tree.c:str_begins_with Unexecuted instantiation: json-istream.c:str_begins_with Unexecuted instantiation: json-parser.c:str_begins_with Unexecuted instantiation: istream-json-string.c:str_begins_with Unexecuted instantiation: json-syntax.c:str_begins_with Unexecuted instantiation: fuzzer.c:str_begins_with Unexecuted instantiation: test-istream.c:str_begins_with Unexecuted instantiation: array.c:str_begins_with Unexecuted instantiation: buffer.c:str_begins_with Unexecuted instantiation: data-stack.c:str_begins_with Unexecuted instantiation: event-log.c:str_begins_with Unexecuted instantiation: failures.c:str_begins_with Unexecuted instantiation: fd-util.c:str_begins_with Unexecuted instantiation: hostpid.c:str_begins_with Unexecuted instantiation: imem.c:str_begins_with Unexecuted instantiation: iostream.c:str_begins_with Unexecuted instantiation: iostream-pump.c:str_begins_with Unexecuted instantiation: istream.c:str_begins_with Unexecuted instantiation: istream-data.c:str_begins_with Unexecuted instantiation: istream-file.c:str_begins_with Unexecuted instantiation: istream-limit.c:str_begins_with Unexecuted instantiation: istream-seekable.c:str_begins_with Unexecuted instantiation: ioloop.c:str_begins_with Unexecuted instantiation: ioloop-notify-inotify.c:str_begins_with Unexecuted instantiation: ioloop-epoll.c:str_begins_with Unexecuted instantiation: lib.c:str_begins_with Unexecuted instantiation: lib-event.c:str_begins_with Unexecuted instantiation: lib-signals.c:str_begins_with Unexecuted instantiation: memarea.c:str_begins_with Unexecuted instantiation: mempool.c:str_begins_with Unexecuted instantiation: mempool-alloconly.c:str_begins_with Unexecuted instantiation: mempool-datastack.c:str_begins_with Unexecuted instantiation: mempool-system.c:str_begins_with Unexecuted instantiation: mempool-unsafe-datastack.c:str_begins_with Unexecuted instantiation: net.c:str_begins_with Unexecuted instantiation: ostream.c:str_begins_with Unexecuted instantiation: ostream-file.c:str_begins_with Unexecuted instantiation: path-util.c:str_begins_with Unexecuted instantiation: printf-format-fix.c:str_begins_with Unexecuted instantiation: process-title.c:str_begins_with Unexecuted instantiation: priorityq.c:str_begins_with Unexecuted instantiation: randgen.c:str_begins_with Unexecuted instantiation: rand.c:str_begins_with Unexecuted instantiation: read-full.c:str_begins_with Unexecuted instantiation: restrict-access.c:str_begins_with Unexecuted instantiation: safe-memset.c:str_begins_with Unexecuted instantiation: safe-mkstemp.c:str_begins_with Unexecuted instantiation: sendfile-util.c:str_begins_with Unexecuted instantiation: sleep.c:str_begins_with Unexecuted instantiation: str.c:str_begins_with Unexecuted instantiation: strescape.c:str_begins_with Unexecuted instantiation: strfuncs.c:str_begins_with Unexecuted instantiation: strnum.c:str_begins_with Unexecuted instantiation: time-util.c:str_begins_with Unexecuted instantiation: unichar.c:str_begins_with Unexecuted instantiation: unicode-break.c:str_begins_with Unexecuted instantiation: unicode-data-tables.c:str_begins_with Unexecuted instantiation: unicode-transform.c:str_begins_with Unexecuted instantiation: write-full.c:str_begins_with Unexecuted instantiation: backtrace-string.c:str_begins_with Unexecuted instantiation: bits.c:str_begins_with Unexecuted instantiation: eacces-error.c:str_begins_with Unexecuted instantiation: env-util.c:str_begins_with Unexecuted instantiation: event-filter.c:str_begins_with Unexecuted instantiation: event-filter-lexer.c:str_begins_with Unexecuted instantiation: event-filter-parser.c:str_begins_with Unexecuted instantiation: hash.c:str_begins_with Unexecuted instantiation: hex-binary.c:str_begins_with Unexecuted instantiation: hmac.c:str_begins_with Unexecuted instantiation: ipwd.c:str_begins_with Unexecuted instantiation: istream-concat.c:str_begins_with Unexecuted instantiation: ioloop-iolist.c:str_begins_with Unexecuted instantiation: ioloop-notify-fd.c:str_begins_with Unexecuted instantiation: primes.c:str_begins_with Unexecuted instantiation: sha2.c:str_begins_with Unexecuted instantiation: xxh64.c:str_begins_with Unexecuted instantiation: str-parse.c:str_begins_with Unexecuted instantiation: wildcard-match.c:str_begins_with |
138 | | static inline ATTR_PURE bool |
139 | | str_begins_icase_with(const char *haystack, const char *needle) |
140 | 0 | { |
141 | 0 | return needle[str_match_icase(haystack, needle)] == '\0'; |
142 | 0 | } Unexecuted instantiation: fuzz-json-istream.c:str_begins_icase_with Unexecuted instantiation: json-tree.c:str_begins_icase_with Unexecuted instantiation: json-istream.c:str_begins_icase_with Unexecuted instantiation: json-parser.c:str_begins_icase_with Unexecuted instantiation: istream-json-string.c:str_begins_icase_with Unexecuted instantiation: json-syntax.c:str_begins_icase_with Unexecuted instantiation: fuzzer.c:str_begins_icase_with Unexecuted instantiation: test-istream.c:str_begins_icase_with Unexecuted instantiation: array.c:str_begins_icase_with Unexecuted instantiation: buffer.c:str_begins_icase_with Unexecuted instantiation: data-stack.c:str_begins_icase_with Unexecuted instantiation: event-log.c:str_begins_icase_with Unexecuted instantiation: failures.c:str_begins_icase_with Unexecuted instantiation: fd-util.c:str_begins_icase_with Unexecuted instantiation: hostpid.c:str_begins_icase_with Unexecuted instantiation: imem.c:str_begins_icase_with Unexecuted instantiation: iostream.c:str_begins_icase_with Unexecuted instantiation: iostream-pump.c:str_begins_icase_with Unexecuted instantiation: istream.c:str_begins_icase_with Unexecuted instantiation: istream-data.c:str_begins_icase_with Unexecuted instantiation: istream-file.c:str_begins_icase_with Unexecuted instantiation: istream-limit.c:str_begins_icase_with Unexecuted instantiation: istream-seekable.c:str_begins_icase_with Unexecuted instantiation: ioloop.c:str_begins_icase_with Unexecuted instantiation: ioloop-notify-inotify.c:str_begins_icase_with Unexecuted instantiation: ioloop-epoll.c:str_begins_icase_with Unexecuted instantiation: lib.c:str_begins_icase_with Unexecuted instantiation: lib-event.c:str_begins_icase_with Unexecuted instantiation: lib-signals.c:str_begins_icase_with Unexecuted instantiation: memarea.c:str_begins_icase_with Unexecuted instantiation: mempool.c:str_begins_icase_with Unexecuted instantiation: mempool-alloconly.c:str_begins_icase_with Unexecuted instantiation: mempool-datastack.c:str_begins_icase_with Unexecuted instantiation: mempool-system.c:str_begins_icase_with Unexecuted instantiation: mempool-unsafe-datastack.c:str_begins_icase_with Unexecuted instantiation: net.c:str_begins_icase_with Unexecuted instantiation: ostream.c:str_begins_icase_with Unexecuted instantiation: ostream-file.c:str_begins_icase_with Unexecuted instantiation: path-util.c:str_begins_icase_with Unexecuted instantiation: printf-format-fix.c:str_begins_icase_with Unexecuted instantiation: process-title.c:str_begins_icase_with Unexecuted instantiation: priorityq.c:str_begins_icase_with Unexecuted instantiation: randgen.c:str_begins_icase_with Unexecuted instantiation: rand.c:str_begins_icase_with Unexecuted instantiation: read-full.c:str_begins_icase_with Unexecuted instantiation: restrict-access.c:str_begins_icase_with Unexecuted instantiation: safe-memset.c:str_begins_icase_with Unexecuted instantiation: safe-mkstemp.c:str_begins_icase_with Unexecuted instantiation: sendfile-util.c:str_begins_icase_with Unexecuted instantiation: sleep.c:str_begins_icase_with Unexecuted instantiation: str.c:str_begins_icase_with Unexecuted instantiation: strescape.c:str_begins_icase_with Unexecuted instantiation: strfuncs.c:str_begins_icase_with Unexecuted instantiation: strnum.c:str_begins_icase_with Unexecuted instantiation: time-util.c:str_begins_icase_with Unexecuted instantiation: unichar.c:str_begins_icase_with Unexecuted instantiation: unicode-break.c:str_begins_icase_with Unexecuted instantiation: unicode-data-tables.c:str_begins_icase_with Unexecuted instantiation: unicode-transform.c:str_begins_icase_with Unexecuted instantiation: write-full.c:str_begins_icase_with Unexecuted instantiation: backtrace-string.c:str_begins_icase_with Unexecuted instantiation: bits.c:str_begins_icase_with Unexecuted instantiation: eacces-error.c:str_begins_icase_with Unexecuted instantiation: env-util.c:str_begins_icase_with Unexecuted instantiation: event-filter.c:str_begins_icase_with Unexecuted instantiation: event-filter-lexer.c:str_begins_icase_with Unexecuted instantiation: event-filter-parser.c:str_begins_icase_with Unexecuted instantiation: hash.c:str_begins_icase_with Unexecuted instantiation: hex-binary.c:str_begins_icase_with Unexecuted instantiation: hmac.c:str_begins_icase_with Unexecuted instantiation: ipwd.c:str_begins_icase_with Unexecuted instantiation: istream-concat.c:str_begins_icase_with Unexecuted instantiation: ioloop-iolist.c:str_begins_icase_with Unexecuted instantiation: ioloop-notify-fd.c:str_begins_icase_with Unexecuted instantiation: primes.c:str_begins_icase_with Unexecuted instantiation: sha2.c:str_begins_icase_with Unexecuted instantiation: xxh64.c:str_begins_icase_with Unexecuted instantiation: str-parse.c:str_begins_icase_with Unexecuted instantiation: wildcard-match.c:str_begins_icase_with |
143 | | #if defined(__GNUC__) && (__GNUC__ >= 2) && !defined(STATIC_CHECKER) |
144 | | /* GCC (and Clang) are known to have a compile-time strlen("literal") shortcut, and |
145 | | an optimised strncmp(), so use that by default. Macro is multi-evaluation safe. */ |
146 | | static inline bool |
147 | | str_begins_builtin_success(const char *haystack, size_t needle_len, |
148 | | const char **suffix_r) |
149 | 0 | { |
150 | 0 | *suffix_r = haystack + needle_len; |
151 | 0 | return TRUE; |
152 | 0 | } Unexecuted instantiation: fuzz-json-istream.c:str_begins_builtin_success Unexecuted instantiation: json-tree.c:str_begins_builtin_success Unexecuted instantiation: json-istream.c:str_begins_builtin_success Unexecuted instantiation: json-parser.c:str_begins_builtin_success Unexecuted instantiation: istream-json-string.c:str_begins_builtin_success Unexecuted instantiation: json-syntax.c:str_begins_builtin_success Unexecuted instantiation: fuzzer.c:str_begins_builtin_success Unexecuted instantiation: test-istream.c:str_begins_builtin_success Unexecuted instantiation: array.c:str_begins_builtin_success Unexecuted instantiation: buffer.c:str_begins_builtin_success Unexecuted instantiation: data-stack.c:str_begins_builtin_success Unexecuted instantiation: event-log.c:str_begins_builtin_success Unexecuted instantiation: failures.c:str_begins_builtin_success Unexecuted instantiation: fd-util.c:str_begins_builtin_success Unexecuted instantiation: hostpid.c:str_begins_builtin_success Unexecuted instantiation: imem.c:str_begins_builtin_success Unexecuted instantiation: iostream.c:str_begins_builtin_success Unexecuted instantiation: iostream-pump.c:str_begins_builtin_success Unexecuted instantiation: istream.c:str_begins_builtin_success Unexecuted instantiation: istream-data.c:str_begins_builtin_success Unexecuted instantiation: istream-file.c:str_begins_builtin_success Unexecuted instantiation: istream-limit.c:str_begins_builtin_success Unexecuted instantiation: istream-seekable.c:str_begins_builtin_success Unexecuted instantiation: ioloop.c:str_begins_builtin_success Unexecuted instantiation: ioloop-notify-inotify.c:str_begins_builtin_success Unexecuted instantiation: ioloop-epoll.c:str_begins_builtin_success Unexecuted instantiation: lib.c:str_begins_builtin_success Unexecuted instantiation: lib-event.c:str_begins_builtin_success Unexecuted instantiation: lib-signals.c:str_begins_builtin_success Unexecuted instantiation: memarea.c:str_begins_builtin_success Unexecuted instantiation: mempool.c:str_begins_builtin_success Unexecuted instantiation: mempool-alloconly.c:str_begins_builtin_success Unexecuted instantiation: mempool-datastack.c:str_begins_builtin_success Unexecuted instantiation: mempool-system.c:str_begins_builtin_success Unexecuted instantiation: mempool-unsafe-datastack.c:str_begins_builtin_success Unexecuted instantiation: net.c:str_begins_builtin_success Unexecuted instantiation: ostream.c:str_begins_builtin_success Unexecuted instantiation: ostream-file.c:str_begins_builtin_success Unexecuted instantiation: path-util.c:str_begins_builtin_success Unexecuted instantiation: printf-format-fix.c:str_begins_builtin_success Unexecuted instantiation: process-title.c:str_begins_builtin_success Unexecuted instantiation: priorityq.c:str_begins_builtin_success Unexecuted instantiation: randgen.c:str_begins_builtin_success Unexecuted instantiation: rand.c:str_begins_builtin_success Unexecuted instantiation: read-full.c:str_begins_builtin_success Unexecuted instantiation: restrict-access.c:str_begins_builtin_success Unexecuted instantiation: safe-memset.c:str_begins_builtin_success Unexecuted instantiation: safe-mkstemp.c:str_begins_builtin_success Unexecuted instantiation: sendfile-util.c:str_begins_builtin_success Unexecuted instantiation: sleep.c:str_begins_builtin_success Unexecuted instantiation: str.c:str_begins_builtin_success Unexecuted instantiation: strescape.c:str_begins_builtin_success Unexecuted instantiation: strfuncs.c:str_begins_builtin_success Unexecuted instantiation: strnum.c:str_begins_builtin_success Unexecuted instantiation: time-util.c:str_begins_builtin_success Unexecuted instantiation: unichar.c:str_begins_builtin_success Unexecuted instantiation: unicode-break.c:str_begins_builtin_success Unexecuted instantiation: unicode-data-tables.c:str_begins_builtin_success Unexecuted instantiation: unicode-transform.c:str_begins_builtin_success Unexecuted instantiation: write-full.c:str_begins_builtin_success Unexecuted instantiation: backtrace-string.c:str_begins_builtin_success Unexecuted instantiation: bits.c:str_begins_builtin_success Unexecuted instantiation: eacces-error.c:str_begins_builtin_success Unexecuted instantiation: env-util.c:str_begins_builtin_success Unexecuted instantiation: event-filter.c:str_begins_builtin_success Unexecuted instantiation: event-filter-lexer.c:str_begins_builtin_success Unexecuted instantiation: event-filter-parser.c:str_begins_builtin_success Unexecuted instantiation: hash.c:str_begins_builtin_success Unexecuted instantiation: hex-binary.c:str_begins_builtin_success Unexecuted instantiation: hmac.c:str_begins_builtin_success Unexecuted instantiation: ipwd.c:str_begins_builtin_success Unexecuted instantiation: istream-concat.c:str_begins_builtin_success Unexecuted instantiation: ioloop-iolist.c:str_begins_builtin_success Unexecuted instantiation: ioloop-notify-fd.c:str_begins_builtin_success Unexecuted instantiation: primes.c:str_begins_builtin_success Unexecuted instantiation: sha2.c:str_begins_builtin_success Unexecuted instantiation: xxh64.c:str_begins_builtin_success Unexecuted instantiation: str-parse.c:str_begins_builtin_success Unexecuted instantiation: wildcard-match.c:str_begins_builtin_success |
153 | | # define str_begins_with(h, n) \ |
154 | 0 | (__builtin_constant_p(n) ? strncmp((h), (n), strlen(n))==0 : \ |
155 | 0 | (str_begins_with)((h), (n))) |
156 | | # define str_begins(h, n, suffix_r) \ |
157 | | (!__builtin_constant_p(n) ? (str_begins)((h), (n), (suffix_r)) : \ |
158 | | (strncmp((h), (n), strlen(n)) != 0 ? FALSE : \ |
159 | | str_begins_builtin_success((h), strlen(n), suffix_r))) |
160 | | |
161 | | # define str_begins_icase_with(h, n) \ |
162 | 0 | (__builtin_constant_p(n) ? strncasecmp((h), (n), strlen(n))==0 : \ |
163 | 0 | (str_begins_icase_with)((h), (n))) |
164 | | # define str_begins_icase(h, n, suffix_r) \ |
165 | | (!__builtin_constant_p(n) ? (str_begins_icase)((h), (n), (suffix_r)) : \ |
166 | | (strncasecmp((h), (n), strlen(n)) != 0 ? FALSE : \ |
167 | | str_begins_builtin_success((h), strlen(n), suffix_r))) |
168 | | #endif |
169 | | |
170 | | static inline ATTR_PURE bool |
171 | | str_ends_with(const char *haystack, const char *suffix) |
172 | 0 | { |
173 | 0 | size_t haystack_len = strlen(haystack); |
174 | 0 | size_t suffix_len = strlen(suffix); |
175 | 0 | if (haystack_len < suffix_len) |
176 | 0 | return FALSE; |
177 | 0 | return strcmp(haystack + haystack_len - suffix_len, suffix) == 0; |
178 | 0 | } Unexecuted instantiation: fuzz-json-istream.c:str_ends_with Unexecuted instantiation: json-tree.c:str_ends_with Unexecuted instantiation: json-istream.c:str_ends_with Unexecuted instantiation: json-parser.c:str_ends_with Unexecuted instantiation: istream-json-string.c:str_ends_with Unexecuted instantiation: json-syntax.c:str_ends_with Unexecuted instantiation: fuzzer.c:str_ends_with Unexecuted instantiation: test-istream.c:str_ends_with Unexecuted instantiation: array.c:str_ends_with Unexecuted instantiation: buffer.c:str_ends_with Unexecuted instantiation: data-stack.c:str_ends_with Unexecuted instantiation: event-log.c:str_ends_with Unexecuted instantiation: failures.c:str_ends_with Unexecuted instantiation: fd-util.c:str_ends_with Unexecuted instantiation: hostpid.c:str_ends_with Unexecuted instantiation: imem.c:str_ends_with Unexecuted instantiation: iostream.c:str_ends_with Unexecuted instantiation: iostream-pump.c:str_ends_with Unexecuted instantiation: istream.c:str_ends_with Unexecuted instantiation: istream-data.c:str_ends_with Unexecuted instantiation: istream-file.c:str_ends_with Unexecuted instantiation: istream-limit.c:str_ends_with Unexecuted instantiation: istream-seekable.c:str_ends_with Unexecuted instantiation: ioloop.c:str_ends_with Unexecuted instantiation: ioloop-notify-inotify.c:str_ends_with Unexecuted instantiation: ioloop-epoll.c:str_ends_with Unexecuted instantiation: lib.c:str_ends_with Unexecuted instantiation: lib-event.c:str_ends_with Unexecuted instantiation: lib-signals.c:str_ends_with Unexecuted instantiation: memarea.c:str_ends_with Unexecuted instantiation: mempool.c:str_ends_with Unexecuted instantiation: mempool-alloconly.c:str_ends_with Unexecuted instantiation: mempool-datastack.c:str_ends_with Unexecuted instantiation: mempool-system.c:str_ends_with Unexecuted instantiation: mempool-unsafe-datastack.c:str_ends_with Unexecuted instantiation: net.c:str_ends_with Unexecuted instantiation: ostream.c:str_ends_with Unexecuted instantiation: ostream-file.c:str_ends_with Unexecuted instantiation: path-util.c:str_ends_with Unexecuted instantiation: printf-format-fix.c:str_ends_with Unexecuted instantiation: process-title.c:str_ends_with Unexecuted instantiation: priorityq.c:str_ends_with Unexecuted instantiation: randgen.c:str_ends_with Unexecuted instantiation: rand.c:str_ends_with Unexecuted instantiation: read-full.c:str_ends_with Unexecuted instantiation: restrict-access.c:str_ends_with Unexecuted instantiation: safe-memset.c:str_ends_with Unexecuted instantiation: safe-mkstemp.c:str_ends_with Unexecuted instantiation: sendfile-util.c:str_ends_with Unexecuted instantiation: sleep.c:str_ends_with Unexecuted instantiation: str.c:str_ends_with Unexecuted instantiation: strescape.c:str_ends_with Unexecuted instantiation: strfuncs.c:str_ends_with Unexecuted instantiation: strnum.c:str_ends_with Unexecuted instantiation: time-util.c:str_ends_with Unexecuted instantiation: unichar.c:str_ends_with Unexecuted instantiation: unicode-break.c:str_ends_with Unexecuted instantiation: unicode-data-tables.c:str_ends_with Unexecuted instantiation: unicode-transform.c:str_ends_with Unexecuted instantiation: write-full.c:str_ends_with Unexecuted instantiation: backtrace-string.c:str_ends_with Unexecuted instantiation: bits.c:str_ends_with Unexecuted instantiation: eacces-error.c:str_ends_with Unexecuted instantiation: env-util.c:str_ends_with Unexecuted instantiation: event-filter.c:str_ends_with Unexecuted instantiation: event-filter-lexer.c:str_ends_with Unexecuted instantiation: event-filter-parser.c:str_ends_with Unexecuted instantiation: hash.c:str_ends_with Unexecuted instantiation: hex-binary.c:str_ends_with Unexecuted instantiation: hmac.c:str_ends_with Unexecuted instantiation: ipwd.c:str_ends_with Unexecuted instantiation: istream-concat.c:str_ends_with Unexecuted instantiation: ioloop-iolist.c:str_ends_with Unexecuted instantiation: ioloop-notify-fd.c:str_ends_with Unexecuted instantiation: primes.c:str_ends_with Unexecuted instantiation: sha2.c:str_ends_with Unexecuted instantiation: xxh64.c:str_ends_with Unexecuted instantiation: str-parse.c:str_ends_with Unexecuted instantiation: wildcard-match.c:str_ends_with |
179 | | |
180 | | static inline ATTR_PURE bool |
181 | | str_ends_icase_with(const char *haystack, const char *suffix) |
182 | 0 | { |
183 | 0 | size_t haystack_len = strlen(haystack); |
184 | 0 | size_t suffix_len = strlen(suffix); |
185 | 0 | if (haystack_len < suffix_len) |
186 | 0 | return FALSE; |
187 | 0 | return strcasecmp(haystack + haystack_len - suffix_len, suffix) == 0; |
188 | 0 | } Unexecuted instantiation: fuzz-json-istream.c:str_ends_icase_with Unexecuted instantiation: json-tree.c:str_ends_icase_with Unexecuted instantiation: json-istream.c:str_ends_icase_with Unexecuted instantiation: json-parser.c:str_ends_icase_with Unexecuted instantiation: istream-json-string.c:str_ends_icase_with Unexecuted instantiation: json-syntax.c:str_ends_icase_with Unexecuted instantiation: fuzzer.c:str_ends_icase_with Unexecuted instantiation: test-istream.c:str_ends_icase_with Unexecuted instantiation: array.c:str_ends_icase_with Unexecuted instantiation: buffer.c:str_ends_icase_with Unexecuted instantiation: data-stack.c:str_ends_icase_with Unexecuted instantiation: event-log.c:str_ends_icase_with Unexecuted instantiation: failures.c:str_ends_icase_with Unexecuted instantiation: fd-util.c:str_ends_icase_with Unexecuted instantiation: hostpid.c:str_ends_icase_with Unexecuted instantiation: imem.c:str_ends_icase_with Unexecuted instantiation: iostream.c:str_ends_icase_with Unexecuted instantiation: iostream-pump.c:str_ends_icase_with Unexecuted instantiation: istream.c:str_ends_icase_with Unexecuted instantiation: istream-data.c:str_ends_icase_with Unexecuted instantiation: istream-file.c:str_ends_icase_with Unexecuted instantiation: istream-limit.c:str_ends_icase_with Unexecuted instantiation: istream-seekable.c:str_ends_icase_with Unexecuted instantiation: ioloop.c:str_ends_icase_with Unexecuted instantiation: ioloop-notify-inotify.c:str_ends_icase_with Unexecuted instantiation: ioloop-epoll.c:str_ends_icase_with Unexecuted instantiation: lib.c:str_ends_icase_with Unexecuted instantiation: lib-event.c:str_ends_icase_with Unexecuted instantiation: lib-signals.c:str_ends_icase_with Unexecuted instantiation: memarea.c:str_ends_icase_with Unexecuted instantiation: mempool.c:str_ends_icase_with Unexecuted instantiation: mempool-alloconly.c:str_ends_icase_with Unexecuted instantiation: mempool-datastack.c:str_ends_icase_with Unexecuted instantiation: mempool-system.c:str_ends_icase_with Unexecuted instantiation: mempool-unsafe-datastack.c:str_ends_icase_with Unexecuted instantiation: net.c:str_ends_icase_with Unexecuted instantiation: ostream.c:str_ends_icase_with Unexecuted instantiation: ostream-file.c:str_ends_icase_with Unexecuted instantiation: path-util.c:str_ends_icase_with Unexecuted instantiation: printf-format-fix.c:str_ends_icase_with Unexecuted instantiation: process-title.c:str_ends_icase_with Unexecuted instantiation: priorityq.c:str_ends_icase_with Unexecuted instantiation: randgen.c:str_ends_icase_with Unexecuted instantiation: rand.c:str_ends_icase_with Unexecuted instantiation: read-full.c:str_ends_icase_with Unexecuted instantiation: restrict-access.c:str_ends_icase_with Unexecuted instantiation: safe-memset.c:str_ends_icase_with Unexecuted instantiation: safe-mkstemp.c:str_ends_icase_with Unexecuted instantiation: sendfile-util.c:str_ends_icase_with Unexecuted instantiation: sleep.c:str_ends_icase_with Unexecuted instantiation: str.c:str_ends_icase_with Unexecuted instantiation: strescape.c:str_ends_icase_with Unexecuted instantiation: strfuncs.c:str_ends_icase_with Unexecuted instantiation: strnum.c:str_ends_icase_with Unexecuted instantiation: time-util.c:str_ends_icase_with Unexecuted instantiation: unichar.c:str_ends_icase_with Unexecuted instantiation: unicode-break.c:str_ends_icase_with Unexecuted instantiation: unicode-data-tables.c:str_ends_icase_with Unexecuted instantiation: unicode-transform.c:str_ends_icase_with Unexecuted instantiation: write-full.c:str_ends_icase_with Unexecuted instantiation: backtrace-string.c:str_ends_icase_with Unexecuted instantiation: bits.c:str_ends_icase_with Unexecuted instantiation: eacces-error.c:str_ends_icase_with Unexecuted instantiation: env-util.c:str_ends_icase_with Unexecuted instantiation: event-filter.c:str_ends_icase_with Unexecuted instantiation: event-filter-lexer.c:str_ends_icase_with Unexecuted instantiation: event-filter-parser.c:str_ends_icase_with Unexecuted instantiation: hash.c:str_ends_icase_with Unexecuted instantiation: hex-binary.c:str_ends_icase_with Unexecuted instantiation: hmac.c:str_ends_icase_with Unexecuted instantiation: ipwd.c:str_ends_icase_with Unexecuted instantiation: istream-concat.c:str_ends_icase_with Unexecuted instantiation: ioloop-iolist.c:str_ends_icase_with Unexecuted instantiation: ioloop-notify-fd.c:str_ends_icase_with Unexecuted instantiation: primes.c:str_ends_icase_with Unexecuted instantiation: sha2.c:str_ends_icase_with Unexecuted instantiation: xxh64.c:str_ends_icase_with Unexecuted instantiation: str-parse.c:str_ends_icase_with Unexecuted instantiation: wildcard-match.c:str_ends_icase_with |
189 | | |
190 | | /* Get length of a prefix segment. |
191 | | |
192 | | Calculates the length (in bytes) of the initial segment of s which consists |
193 | | entirely of bytes in accept. |
194 | | */ |
195 | | size_t i_memspn(const void *data, size_t data_len, |
196 | | const void *accept, size_t accept_len); |
197 | | /* Get length of a prefix segment. |
198 | | |
199 | | Calculates the length of the initial segment of s which consists entirely of |
200 | | bytes not in reject. |
201 | | */ |
202 | | size_t i_memcspn(const void *data, size_t data_len, |
203 | | const void *reject, size_t reject_len); |
204 | | |
205 | | static inline char *i_strchr_to_next(const char *str, char chr) |
206 | 0 | { |
207 | 0 | char *tmp = (char *)strchr(str, chr); |
208 | 0 | return tmp == NULL ? NULL : tmp+1; |
209 | 0 | } Unexecuted instantiation: fuzz-json-istream.c:i_strchr_to_next Unexecuted instantiation: json-tree.c:i_strchr_to_next Unexecuted instantiation: json-istream.c:i_strchr_to_next Unexecuted instantiation: json-parser.c:i_strchr_to_next Unexecuted instantiation: istream-json-string.c:i_strchr_to_next Unexecuted instantiation: json-syntax.c:i_strchr_to_next Unexecuted instantiation: fuzzer.c:i_strchr_to_next Unexecuted instantiation: test-istream.c:i_strchr_to_next Unexecuted instantiation: array.c:i_strchr_to_next Unexecuted instantiation: buffer.c:i_strchr_to_next Unexecuted instantiation: data-stack.c:i_strchr_to_next Unexecuted instantiation: event-log.c:i_strchr_to_next Unexecuted instantiation: failures.c:i_strchr_to_next Unexecuted instantiation: fd-util.c:i_strchr_to_next Unexecuted instantiation: hostpid.c:i_strchr_to_next Unexecuted instantiation: imem.c:i_strchr_to_next Unexecuted instantiation: iostream.c:i_strchr_to_next Unexecuted instantiation: iostream-pump.c:i_strchr_to_next Unexecuted instantiation: istream.c:i_strchr_to_next Unexecuted instantiation: istream-data.c:i_strchr_to_next Unexecuted instantiation: istream-file.c:i_strchr_to_next Unexecuted instantiation: istream-limit.c:i_strchr_to_next Unexecuted instantiation: istream-seekable.c:i_strchr_to_next Unexecuted instantiation: ioloop.c:i_strchr_to_next Unexecuted instantiation: ioloop-notify-inotify.c:i_strchr_to_next Unexecuted instantiation: ioloop-epoll.c:i_strchr_to_next Unexecuted instantiation: lib.c:i_strchr_to_next Unexecuted instantiation: lib-event.c:i_strchr_to_next Unexecuted instantiation: lib-signals.c:i_strchr_to_next Unexecuted instantiation: memarea.c:i_strchr_to_next Unexecuted instantiation: mempool.c:i_strchr_to_next Unexecuted instantiation: mempool-alloconly.c:i_strchr_to_next Unexecuted instantiation: mempool-datastack.c:i_strchr_to_next Unexecuted instantiation: mempool-system.c:i_strchr_to_next Unexecuted instantiation: mempool-unsafe-datastack.c:i_strchr_to_next Unexecuted instantiation: net.c:i_strchr_to_next Unexecuted instantiation: ostream.c:i_strchr_to_next Unexecuted instantiation: ostream-file.c:i_strchr_to_next Unexecuted instantiation: path-util.c:i_strchr_to_next Unexecuted instantiation: printf-format-fix.c:i_strchr_to_next Unexecuted instantiation: process-title.c:i_strchr_to_next Unexecuted instantiation: priorityq.c:i_strchr_to_next Unexecuted instantiation: randgen.c:i_strchr_to_next Unexecuted instantiation: rand.c:i_strchr_to_next Unexecuted instantiation: read-full.c:i_strchr_to_next Unexecuted instantiation: restrict-access.c:i_strchr_to_next Unexecuted instantiation: safe-memset.c:i_strchr_to_next Unexecuted instantiation: safe-mkstemp.c:i_strchr_to_next Unexecuted instantiation: sendfile-util.c:i_strchr_to_next Unexecuted instantiation: sleep.c:i_strchr_to_next Unexecuted instantiation: str.c:i_strchr_to_next Unexecuted instantiation: strescape.c:i_strchr_to_next Unexecuted instantiation: strfuncs.c:i_strchr_to_next Unexecuted instantiation: strnum.c:i_strchr_to_next Unexecuted instantiation: time-util.c:i_strchr_to_next Unexecuted instantiation: unichar.c:i_strchr_to_next Unexecuted instantiation: unicode-break.c:i_strchr_to_next Unexecuted instantiation: unicode-data-tables.c:i_strchr_to_next Unexecuted instantiation: unicode-transform.c:i_strchr_to_next Unexecuted instantiation: write-full.c:i_strchr_to_next Unexecuted instantiation: backtrace-string.c:i_strchr_to_next Unexecuted instantiation: bits.c:i_strchr_to_next Unexecuted instantiation: eacces-error.c:i_strchr_to_next Unexecuted instantiation: env-util.c:i_strchr_to_next Unexecuted instantiation: event-filter.c:i_strchr_to_next Unexecuted instantiation: event-filter-lexer.c:i_strchr_to_next Unexecuted instantiation: event-filter-parser.c:i_strchr_to_next Unexecuted instantiation: hash.c:i_strchr_to_next Unexecuted instantiation: hex-binary.c:i_strchr_to_next Unexecuted instantiation: hmac.c:i_strchr_to_next Unexecuted instantiation: ipwd.c:i_strchr_to_next Unexecuted instantiation: istream-concat.c:i_strchr_to_next Unexecuted instantiation: ioloop-iolist.c:i_strchr_to_next Unexecuted instantiation: ioloop-notify-fd.c:i_strchr_to_next Unexecuted instantiation: primes.c:i_strchr_to_next Unexecuted instantiation: sha2.c:i_strchr_to_next Unexecuted instantiation: xxh64.c:i_strchr_to_next Unexecuted instantiation: str-parse.c:i_strchr_to_next Unexecuted instantiation: wildcard-match.c:i_strchr_to_next |
210 | | |
211 | | /* Split only on the first separator encountered. |
212 | | Returns TRUE if the separator was found, FALSE and *value_r = "" otherwise. |
213 | | Normally it's fine (or even useful) to treat "key" and "key=" identically, |
214 | | so return value can just be ignored. */ |
215 | | bool t_split_key_value(const char *arg, char separator, |
216 | | const char **key_r, const char **value_r) |
217 | | ATTR_NOWARN_UNUSED_RESULT; |
218 | | static inline bool ATTR_NOWARN_UNUSED_RESULT |
219 | 0 | t_split_key_value_eq(const char *arg, const char **key_r, const char **value_r) { |
220 | 0 | return t_split_key_value(arg, '=', key_r, value_r); |
221 | 0 | } Unexecuted instantiation: fuzz-json-istream.c:t_split_key_value_eq Unexecuted instantiation: json-tree.c:t_split_key_value_eq Unexecuted instantiation: json-istream.c:t_split_key_value_eq Unexecuted instantiation: json-parser.c:t_split_key_value_eq Unexecuted instantiation: istream-json-string.c:t_split_key_value_eq Unexecuted instantiation: json-syntax.c:t_split_key_value_eq Unexecuted instantiation: fuzzer.c:t_split_key_value_eq Unexecuted instantiation: test-istream.c:t_split_key_value_eq Unexecuted instantiation: array.c:t_split_key_value_eq Unexecuted instantiation: buffer.c:t_split_key_value_eq Unexecuted instantiation: data-stack.c:t_split_key_value_eq Unexecuted instantiation: event-log.c:t_split_key_value_eq Unexecuted instantiation: failures.c:t_split_key_value_eq Unexecuted instantiation: fd-util.c:t_split_key_value_eq Unexecuted instantiation: hostpid.c:t_split_key_value_eq Unexecuted instantiation: imem.c:t_split_key_value_eq Unexecuted instantiation: iostream.c:t_split_key_value_eq Unexecuted instantiation: iostream-pump.c:t_split_key_value_eq Unexecuted instantiation: istream.c:t_split_key_value_eq Unexecuted instantiation: istream-data.c:t_split_key_value_eq Unexecuted instantiation: istream-file.c:t_split_key_value_eq Unexecuted instantiation: istream-limit.c:t_split_key_value_eq Unexecuted instantiation: istream-seekable.c:t_split_key_value_eq Unexecuted instantiation: ioloop.c:t_split_key_value_eq Unexecuted instantiation: ioloop-notify-inotify.c:t_split_key_value_eq Unexecuted instantiation: ioloop-epoll.c:t_split_key_value_eq Unexecuted instantiation: lib.c:t_split_key_value_eq Unexecuted instantiation: lib-event.c:t_split_key_value_eq Unexecuted instantiation: lib-signals.c:t_split_key_value_eq Unexecuted instantiation: memarea.c:t_split_key_value_eq Unexecuted instantiation: mempool.c:t_split_key_value_eq Unexecuted instantiation: mempool-alloconly.c:t_split_key_value_eq Unexecuted instantiation: mempool-datastack.c:t_split_key_value_eq Unexecuted instantiation: mempool-system.c:t_split_key_value_eq Unexecuted instantiation: mempool-unsafe-datastack.c:t_split_key_value_eq Unexecuted instantiation: net.c:t_split_key_value_eq Unexecuted instantiation: ostream.c:t_split_key_value_eq Unexecuted instantiation: ostream-file.c:t_split_key_value_eq Unexecuted instantiation: path-util.c:t_split_key_value_eq Unexecuted instantiation: printf-format-fix.c:t_split_key_value_eq Unexecuted instantiation: process-title.c:t_split_key_value_eq Unexecuted instantiation: priorityq.c:t_split_key_value_eq Unexecuted instantiation: randgen.c:t_split_key_value_eq Unexecuted instantiation: rand.c:t_split_key_value_eq Unexecuted instantiation: read-full.c:t_split_key_value_eq Unexecuted instantiation: restrict-access.c:t_split_key_value_eq Unexecuted instantiation: safe-memset.c:t_split_key_value_eq Unexecuted instantiation: safe-mkstemp.c:t_split_key_value_eq Unexecuted instantiation: sendfile-util.c:t_split_key_value_eq Unexecuted instantiation: sleep.c:t_split_key_value_eq Unexecuted instantiation: str.c:t_split_key_value_eq Unexecuted instantiation: strescape.c:t_split_key_value_eq Unexecuted instantiation: strfuncs.c:t_split_key_value_eq Unexecuted instantiation: strnum.c:t_split_key_value_eq Unexecuted instantiation: time-util.c:t_split_key_value_eq Unexecuted instantiation: unichar.c:t_split_key_value_eq Unexecuted instantiation: unicode-break.c:t_split_key_value_eq Unexecuted instantiation: unicode-data-tables.c:t_split_key_value_eq Unexecuted instantiation: unicode-transform.c:t_split_key_value_eq Unexecuted instantiation: write-full.c:t_split_key_value_eq Unexecuted instantiation: backtrace-string.c:t_split_key_value_eq Unexecuted instantiation: bits.c:t_split_key_value_eq Unexecuted instantiation: eacces-error.c:t_split_key_value_eq Unexecuted instantiation: env-util.c:t_split_key_value_eq Unexecuted instantiation: event-filter.c:t_split_key_value_eq Unexecuted instantiation: event-filter-lexer.c:t_split_key_value_eq Unexecuted instantiation: event-filter-parser.c:t_split_key_value_eq Unexecuted instantiation: hash.c:t_split_key_value_eq Unexecuted instantiation: hex-binary.c:t_split_key_value_eq Unexecuted instantiation: hmac.c:t_split_key_value_eq Unexecuted instantiation: ipwd.c:t_split_key_value_eq Unexecuted instantiation: istream-concat.c:t_split_key_value_eq Unexecuted instantiation: ioloop-iolist.c:t_split_key_value_eq Unexecuted instantiation: ioloop-notify-fd.c:t_split_key_value_eq Unexecuted instantiation: primes.c:t_split_key_value_eq Unexecuted instantiation: sha2.c:t_split_key_value_eq Unexecuted instantiation: xxh64.c:t_split_key_value_eq Unexecuted instantiation: str-parse.c:t_split_key_value_eq Unexecuted instantiation: wildcard-match.c:t_split_key_value_eq |
222 | | |
223 | | /* separators is an array of separator characters, not a separator string. |
224 | | an empty data string results in an array containing only NULL. */ |
225 | | char **p_strsplit(pool_t pool, const char *data, const char *separators) |
226 | | ATTR_MALLOC ATTR_RETURNS_NONNULL; |
227 | | const char **t_strsplit(const char *data, const char *separators) |
228 | | ATTR_MALLOC ATTR_RETURNS_NONNULL; |
229 | | /* like p_strsplit(), but treats multiple adjacent separators as a single |
230 | | separator. separators at the beginning or at the end of the string are also |
231 | | ignored, so it's not possible for the result to have any empty strings. */ |
232 | | char **p_strsplit_spaces(pool_t pool, const char *data, const char *separators) |
233 | | ATTR_MALLOC ATTR_RETURNS_NONNULL; |
234 | | const char **t_strsplit_spaces(const char *data, const char *separators) |
235 | | ATTR_MALLOC ATTR_RETURNS_NONNULL; |
236 | | void p_strsplit_free(pool_t pool, char **arr); |
237 | | |
238 | | const char *dec2str(uintmax_t number); |
239 | | /* Use the given buffer to write out the number. Returns pointer to the |
240 | | written number in the buffer. Note that this isn't the same as the beginning |
241 | | of the buffer. */ |
242 | | char *dec2str_buf(char buffer[STATIC_ARRAY MAX_INT_STRLEN], uintmax_t number); |
243 | | |
244 | | /* Return length of NULL-terminated list string array */ |
245 | | unsigned int str_array_length(const char *const *arr) ATTR_PURE; |
246 | | /* Return all strings from array joined into one string. */ |
247 | | const char *t_strarray_join(const char *const *arr, const char *separator) |
248 | | ATTR_MALLOC ATTR_RETURNS_NONNULL; |
249 | | /* Removes a value from NULL-terminated string array. Returns TRUE if found. */ |
250 | | bool str_array_remove(const char **arr, const char *value); |
251 | | /* Returns TRUE if value exists in NULL-terminated string array. */ |
252 | | bool str_array_find(const char *const *arr, const char *value); |
253 | | /* Like str_array_find(), but use strcasecmp(). */ |
254 | | bool str_array_icase_find(const char *const *arr, const char *value); |
255 | | /* Duplicate array of strings. The memory can be freed by freeing the |
256 | | return value. */ |
257 | | const char **p_strarray_dup(pool_t pool, const char *const *arr) |
258 | | ATTR_MALLOC ATTR_RETURNS_NONNULL; |
259 | | |
260 | | /* Join ARRAY_TYPE(const_string) to a string, similar to t_strarray_join() */ |
261 | | char *p_array_const_string_join(pool_t pool, const ARRAY_TYPE(const_string) *arr, |
262 | | const char *separator); |
263 | | #define t_array_const_string_join(arr, separator) \ |
264 | 0 | ((const char *)p_array_const_string_join(unsafe_data_stack_pool, arr, separator)) |
265 | | |
266 | | /* INTERNAL */ |
267 | | char *t_noalloc_strdup_vprintf(const char *format, va_list args, |
268 | | unsigned int *size_r) |
269 | | ATTR_FORMAT(1, 0) ATTR_RETURNS_NONNULL; |
270 | | char *vstrconcat(const char *str1, va_list args, size_t *ret_len) ATTR_MALLOC; |
271 | | |
272 | | #endif |