FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavutil/avstring.c
Date: 2026-11-01 12:52:33
Exec Total Coverage
Lines: 227 250 90.8%
Functions: 20 20 100.0%
Branches: 167 210 79.5%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
3 * Copyright (c) 2007 Mans Rullgard
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include <limits.h>
23 #include <stdarg.h>
24 #include <stdint.h>
25 #include <stdio.h>
26 #include <string.h>
27
28 #include "config.h"
29 #include "mem.h"
30 #include "avassert.h"
31 #include "avstring.h"
32 #include "bprint.h"
33 #include "error.h"
34 #include "macros.h"
35
36 205535348 int av_strstart(const char *str, const char *pfx, const char **ptr)
37 {
38
4/4
✓ Branch 0 taken 223541761 times.
✓ Branch 1 taken 1413869 times.
✓ Branch 2 taken 19420282 times.
✓ Branch 3 taken 204121479 times.
224955630 while (*pfx && *pfx == *str) {
39 19420282 pfx++;
40 19420282 str++;
41 }
42
4/4
✓ Branch 0 taken 1413869 times.
✓ Branch 1 taken 204121479 times.
✓ Branch 2 taken 1412791 times.
✓ Branch 3 taken 1078 times.
205535348 if (!*pfx && ptr)
43 1412791 *ptr = str;
44 205535348 return !*pfx;
45 }
46
47 16266 int av_stristart(const char *str, const char *pfx, const char **ptr)
48 {
49
4/4
✓ Branch 0 taken 17704 times.
✓ Branch 1 taken 331 times.
✓ Branch 2 taken 1769 times.
✓ Branch 3 taken 15935 times.
18035 while (*pfx && av_toupper((unsigned)*pfx) == av_toupper((unsigned)*str)) {
50 1769 pfx++;
51 1769 str++;
52 }
53
4/4
✓ Branch 0 taken 331 times.
✓ Branch 1 taken 15935 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 327 times.
16266 if (!*pfx && ptr)
54 4 *ptr = str;
55 16266 return !*pfx;
56 }
57
58 904 char *av_stristr(const char *s1, const char *s2)
59 {
60
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 904 times.
904 if (!*s2)
61 ✗ return (char*)(intptr_t)s1;
62
63 do
64
2/2
✓ Branch 1 taken 327 times.
✓ Branch 2 taken 15920 times.
16247 if (av_stristart(s1, s2, NULL))
65 327 return (char*)(intptr_t)s1;
66
2/2
✓ Branch 0 taken 15343 times.
✓ Branch 1 taken 577 times.
15920 while (*s1++);
67
68 577 return NULL;
69 }
70
71 8 char *av_strnstr(const char *haystack, const char *needle, size_t hay_length)
72 {
73 8 size_t needle_len = strlen(needle);
74
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7 times.
8 if (!needle_len)
75 1 return (char*)haystack;
76
2/2
✓ Branch 0 taken 353 times.
✓ Branch 1 taken 1 times.
354 while (hay_length >= needle_len) {
77 353 hay_length--;
78
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 347 times.
353 if (!memcmp(haystack, needle, needle_len))
79 6 return (char*)haystack;
80 347 haystack++;
81 }
82 1 return NULL;
83 }
84
85 406983 size_t av_strlcpy(char *dst, const char *src, size_t size)
86 {
87 406983 size_t len = 0;
88
4/4
✓ Branch 0 taken 2523990 times.
✓ Branch 1 taken 136649 times.
✓ Branch 2 taken 2253656 times.
✓ Branch 3 taken 270334 times.
2660639 while (++len < size && *src)
89 2253656 *dst++ = *src++;
90
1/2
✓ Branch 0 taken 406983 times.
✗ Branch 1 not taken.
406983 if (len <= size)
91 406983 *dst = 0;
92 406983 return len + strlen(src) - 1;
93 }
94
95 68258 size_t av_strlcat(char *dst, const char *src, size_t size)
96 {
97 68258 size_t len = strlen(dst);
98
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 68258 times.
68258 if (size <= len + 1)
99 ✗ return len + strlen(src);
100 68258 return len + av_strlcpy(dst + len, src, size - len);
101 }
102
103 165240 size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
104 {
105 165240 size_t len = strlen(dst);
106 va_list vl;
107
108 165240 va_start(vl, fmt);
109
1/2
✓ Branch 0 taken 165240 times.
✗ Branch 1 not taken.
165240 len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
110 165240 va_end(vl);
111
112 165240 return len;
113 }
114
115 18375 char *av_asprintf(const char *fmt, ...)
116 {
117 18375 char *p = NULL;
118 va_list va;
119 int len;
120
121 18375 va_start(va, fmt);
122 18375 len = vsnprintf(NULL, 0, fmt, va);
123 18375 va_end(va);
124
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18375 times.
18375 if (len < 0)
125 ✗ goto end;
126
127 18375 p = av_malloc(len + 1);
128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18375 times.
18375 if (!p)
129 ✗ goto end;
130
131 18375 va_start(va, fmt);
132 18375 len = vsnprintf(p, len + 1, fmt, va);
133 18375 va_end(va);
134
1/2
✓ Branch 0 taken 18375 times.
✗ Branch 1 not taken.
18375 if (len < 0)
135 ✗ av_freep(&p);
136
137 18375 end:
138 18375 return p;
139 }
140
141 #define WHITESPACES " \n\t\r"
142
143 131163 char *av_get_token(const char **buf, const char *term)
144 {
145 131163 char *out = av_realloc(NULL, strlen(*buf) + 1);
146 131163 char *ret = out, *end = out;
147 131163 const char *p = *buf;
148
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 131163 times.
131163 if (!out)
149 ✗ return NULL;
150 131163 p += strspn(p, WHITESPACES);
151
152
4/4
✓ Branch 0 taken 1332290 times.
✓ Branch 1 taken 48041 times.
✓ Branch 2 taken 1249168 times.
✓ Branch 3 taken 83122 times.
1380331 while (*p && !strspn(p, term)) {
153 1249168 char c = *p++;
154
4/4
✓ Branch 0 taken 235 times.
✓ Branch 1 taken 1248933 times.
✓ Branch 2 taken 233 times.
✓ Branch 3 taken 2 times.
1249168 if (c == '\\' && *p) {
155 233 *out++ = *p++;
156 233 end = out;
157
2/2
✓ Branch 0 taken 54 times.
✓ Branch 1 taken 1248881 times.
1248935 } else if (c == '\'') {
158
4/4
✓ Branch 0 taken 932 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 882 times.
✓ Branch 3 taken 50 times.
936 while (*p && *p != '\'')
159 882 *out++ = *p++;
160
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 4 times.
54 if (*p) {
161 50 p++;
162 50 end = out;
163 }
164 } else {
165 1248881 *out++ = c;
166 }
167 }
168
169 do
170 131637 *out-- = 0;
171
4/4
✓ Branch 0 taken 129735 times.
✓ Branch 1 taken 1902 times.
✓ Branch 2 taken 474 times.
✓ Branch 3 taken 129261 times.
131637 while (out >= end && strspn(out, WHITESPACES));
172
173 131163 *buf = p;
174
175 131163 char *small_ret = av_realloc(ret, out - ret + 2);
176
1/2
✓ Branch 0 taken 131163 times.
✗ Branch 1 not taken.
131163 return small_ret ? small_ret : ret;
177 }
178
179 10913 char *av_strtok(char *s, const char *delim, char **saveptr)
180 {
181 char *tok;
182
183
4/4
✓ Branch 0 taken 9039 times.
✓ Branch 1 taken 1874 times.
✓ Branch 2 taken 508 times.
✓ Branch 3 taken 8531 times.
10913 if (!s && !(s = *saveptr))
184 508 return NULL;
185
186 /* skip leading delimiters */
187 10405 s += strspn(s, delim);
188
189 /* s now points to the first non delimiter char, or to the end of the string */
190
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 10369 times.
10405 if (!*s) {
191 36 *saveptr = NULL;
192 36 return NULL;
193 }
194 10369 tok = s++;
195
196 /* skip non delimiters */
197 10369 s += strcspn(s, delim);
198
2/2
✓ Branch 0 taken 8875 times.
✓ Branch 1 taken 1494 times.
10369 if (*s) {
199 8875 *s = 0;
200 8875 *saveptr = s+1;
201 } else {
202 1494 *saveptr = NULL;
203 }
204
205 10369 return tok;
206 }
207
208 722122 int av_strcasecmp(const char *a, const char *b)
209 {
210 uint8_t c1, c2;
211 do {
212 802098 c1 = av_tolower(*a++);
213 802098 c2 = av_tolower(*b++);
214
4/4
✓ Branch 0 taken 796371 times.
✓ Branch 1 taken 5727 times.
✓ Branch 2 taken 79976 times.
✓ Branch 3 taken 716395 times.
802098 } while (c1 && c1 == c2);
215 722122 return c1 - c2;
216 }
217
218 3987595 int av_strncasecmp(const char *a, const char *b, size_t n)
219 {
220 uint8_t c1, c2;
221
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3987595 times.
3987595 if (n <= 0)
222 ✗ return 0;
223 do {
224 4358945 c1 = av_tolower(*a++);
225 4358945 c2 = av_tolower(*b++);
226
6/6
✓ Branch 0 taken 4313015 times.
✓ Branch 1 taken 45930 times.
✓ Branch 2 taken 4310844 times.
✓ Branch 3 taken 2171 times.
✓ Branch 4 taken 371350 times.
✓ Branch 5 taken 3939494 times.
4358945 } while (--n && c1 && c1 == c2);
227 3987595 return c1 - c2;
228 }
229
230 6 char *av_strireplace(const char *str, const char *from, const char *to)
231 {
232 6 char *ret = NULL;
233 6 const char *pstr2, *pstr = str;
234 6 size_t tolen = strlen(to), fromlen = strlen(from);
235 AVBPrint pbuf;
236
237
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (!fromlen)
238 ✗ return av_strdup(str);
239
240 6 av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
241
2/2
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
12 while ((pstr2 = av_stristr(pstr, from))) {
242 6 av_bprint_append_data(&pbuf, pstr, pstr2 - pstr);
243 6 pstr = pstr2 + fromlen;
244 6 av_bprint_append_data(&pbuf, to, tolen);
245 }
246 6 av_bprint_append_data(&pbuf, pstr, strlen(pstr));
247
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
6 if (!av_bprint_is_complete(&pbuf)) {
248 ✗ av_bprint_finalize(&pbuf, NULL);
249 } else {
250 6 av_bprint_finalize(&pbuf, &ret);
251 }
252
253 6 return ret;
254 }
255
256 205 const char *av_basename(const char *path)
257 {
258
2/4
✓ Branch 0 taken 205 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 205 times.
205 if (!path || *path == '\0')
259 ✗ return ".";
260
261 205 const char *p = strrchr(path, '/');
262 #if HAVE_DOS_PATHS
263 const char *q = strrchr(path, '\\');
264 const char *d = strchr(path, ':');
265 p = FFMAX3(p, q, d);
266 #endif
267
268
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 199 times.
205 if (!p)
269 6 return path;
270
271 199 return p + 1;
272 }
273
274 59 const char *av_dirname(char *path)
275 {
276
1/2
✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
59 char *p = path ? strrchr(path, '/') : NULL;
277
278 #if HAVE_DOS_PATHS
279 char *q = path ? strrchr(path, '\\') : NULL;
280 char *d = path ? strchr(path, ':') : NULL;
281
282 d = d ? d + 1 : d;
283
284 p = FFMAX3(p, q, d);
285 #endif
286
287
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 55 times.
59 if (!p)
288 4 return ".";
289
290 55 *p = '\0';
291
292 55 return path;
293 }
294
295 9 char *av_append_path_component(const char *path, const char *component)
296 {
297 size_t p_len, c_len;
298 char *fullpath;
299
300
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7 times.
9 if (!path)
301 2 return av_strdup(component);
302
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 6 times.
7 if (!component)
303 1 return av_strdup(path);
304
305 6 p_len = strlen(path);
306 6 c_len = strlen(component);
307
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
6 if (p_len > SIZE_MAX - c_len || p_len + c_len > SIZE_MAX - 2)
308 ✗ return NULL;
309 6 fullpath = av_malloc(p_len + c_len + 2);
310
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (fullpath) {
311
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (p_len) {
312 6 av_strlcpy(fullpath, path, p_len + 1);
313
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (c_len) {
314
4/4
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
6 if (fullpath[p_len - 1] != '/' && component[0] != '/')
315 2 fullpath[p_len++] = '/';
316
4/4
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
4 else if (fullpath[p_len - 1] == '/' && component[0] == '/')
317 2 p_len--;
318 }
319 }
320 6 av_strlcpy(&fullpath[p_len], component, c_len + 1);
321 6 fullpath[p_len + c_len] = 0;
322 }
323 6 return fullpath;
324 }
325
326 139 int av_escape(char **dst, const char *src, const char *special_chars,
327 enum AVEscapeMode mode, int flags)
328 {
329 AVBPrint dstbuf;
330 int ret;
331
332 139 av_bprint_init(&dstbuf, 1, INT_MAX); /* (int)dstbuf.len must be >= 0 */
333 139 av_bprint_escape(&dstbuf, src, special_chars, mode, flags);
334
335
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 139 times.
139 if (!av_bprint_is_complete(&dstbuf)) {
336 ✗ av_bprint_finalize(&dstbuf, NULL);
337 ✗ return AVERROR(ENOMEM);
338 }
339
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 139 times.
139 if ((ret = av_bprint_finalize(&dstbuf, dst)) < 0)
340 ✗ return ret;
341 139 return dstbuf.len;
342 }
343
344 9274080 int av_match_name(const char *name, const char *names)
345 {
346 const char *p;
347 size_t len, namelen;
348
349
4/4
✓ Branch 0 taken 6206775 times.
✓ Branch 1 taken 3067305 times.
✓ Branch 2 taken 2726672 times.
✓ Branch 3 taken 3480103 times.
9274080 if (!name || !names)
350 5793977 return 0;
351
352 3480103 namelen = strlen(name);
353
2/2
✓ Branch 0 taken 3968838 times.
✓ Branch 1 taken 3461814 times.
7430652 while (*names) {
354 3968838 int negate = '-' == *names;
355 3968838 p = strchr(names, ',');
356
2/2
✓ Branch 0 taken 3477869 times.
✓ Branch 1 taken 490969 times.
3968838 if (!p)
357 3477869 p = names + strlen(names);
358 3968838 names += negate;
359 3968838 len = FFMAX(p - names, namelen);
360
3/4
✓ Branch 1 taken 3950549 times.
✓ Branch 2 taken 18289 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3950549 times.
3968838 if (!av_strncasecmp(name, names, len) || !strncmp("ALL", names, FFMAX(3, p - names)))
361 18289 return !negate;
362 3950549 names = p + (*p == ',');
363 }
364 3461814 return 0;
365 }
366
367 259966 int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
368 unsigned int flags)
369 {
370 259966 const uint8_t *p = *bufp;
371 uint32_t top;
372 uint64_t code;
373 259966 int ret = 0, tail_len;
374 259966 uint32_t overlong_encoding_mins[6] = {
375 0x00000000, 0x00000080, 0x00000800, 0x00010000, 0x00200000, 0x04000000,
376 };
377
378
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 259966 times.
259966 if (p >= buf_end)
379 ✗ return 0;
380
381 259966 code = *p++;
382
383 /* first sequence byte starts with 10, or is 1111-1110 or 1111-1111,
384 which is not admitted */
385
4/4
✓ Branch 0 taken 259964 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 259963 times.
259966 if ((code & 0xc0) == 0x80 || code >= 0xFE) {
386 3 ret = AVERROR(EILSEQ);
387 3 goto end;
388 }
389 259963 top = (code & 128) >> 1;
390
391 259963 tail_len = 0;
392
2/2
✓ Branch 0 taken 929 times.
✓ Branch 1 taken 259961 times.
260890 while (code & top) {
393 int tmp;
394 929 tail_len++;
395
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 928 times.
929 if (p >= buf_end) {
396 1 (*bufp) ++;
397 1 return AVERROR(EILSEQ); /* incomplete sequence */
398 }
399
400 /* we assume the byte to be in the form 10xx-xxxx */
401 928 tmp = *p++ - 128; /* strip leading 1 */
402
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 927 times.
928 if (tmp>>6) {
403 1 (*bufp) ++;
404 1 return AVERROR(EILSEQ);
405 }
406 927 code = (code<<6) + tmp;
407 927 top <<= 5;
408 }
409 259961 code &= (top << 1) - 1;
410
411 /* check for overlong encodings */
412
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 259961 times.
259961 av_assert0(tail_len <= 5);
413
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 259959 times.
259961 if (code < overlong_encoding_mins[tail_len]) {
414 2 ret = AVERROR(EILSEQ);
415 2 goto end;
416 }
417
418
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 259959 times.
259959 if (code >= 1U<<31) {
419 ✗ ret = AVERROR(EILSEQ); /* out-of-range value */
420 ✗ goto end;
421 }
422
423 259959 *codep = code;
424
425
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 259957 times.
259959 if (code > 0x10FFFF &&
426
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 !(flags & AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES))
427 2 ret = AVERROR(EILSEQ);
428
6/8
✓ Branch 0 taken 2017 times.
✓ Branch 1 taken 257942 times.
✓ Branch 2 taken 2017 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 91 times.
✓ Branch 5 taken 1926 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 91 times.
259959 if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD &&
429 ✗ flags & AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES)
430 ✗ ret = AVERROR(EILSEQ);
431
4/4
✓ Branch 0 taken 384 times.
✓ Branch 1 taken 259575 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 383 times.
259959 if (code >= 0xD800 && code <= 0xDFFF &&
432
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 !(flags & AV_UTF8_FLAG_ACCEPT_SURROGATES))
433 1 ret = AVERROR(EILSEQ);
434
3/4
✓ Branch 0 taken 259959 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 259958 times.
✓ Branch 3 taken 1 times.
259959 if ((code == 0xFFFE || code == 0xFFFF) &&
435
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 !(flags & AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS))
436 1 ret = AVERROR(EILSEQ);
437
438 259958 end:
439 259964 *bufp = p;
440 259964 return ret;
441 }
442
443 249 int av_match_list(const char *name, const char *list, char separator)
444 {
445 const char *p, *q;
446
447
2/4
✓ Branch 0 taken 249 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 249 times.
✗ Branch 3 not taken.
498 for (p = name; p && *p; ) {
448
2/4
✓ Branch 0 taken 255 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 255 times.
✗ Branch 3 not taken.
504 for (q = list; q && *q; ) {
449 int k;
450
5/6
✓ Branch 0 taken 1003 times.
✓ Branch 1 taken 248 times.
✓ Branch 2 taken 242 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 242 times.
✗ Branch 5 not taken.
1251 for (k = 0; p[k] == q[k] || (p[k]*q[k] == 0 && p[k]+q[k] == separator); k++)
451
5/6
✓ Branch 0 taken 996 times.
✓ Branch 1 taken 249 times.
✓ Branch 2 taken 747 times.
✓ Branch 3 taken 249 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 747 times.
1245 if (k && (!p[k] || p[k] == separator))
452 249 return 1;
453 6 q = strchr(q, separator);
454
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if(q)
455 6 q++;
456 }
457 ✗ p = strchr(p, separator);
458 ✗ if (p)
459 ✗ p++;
460 }
461
462 ✗ return 0;
463 }
464