dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / firmware / efi / libstub / string.c
blobed10e3f602c5edde5b57a502dd7d0b74c0dd6fb0
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Taken from:
4 * linux/lib/string.c
6 * Copyright (C) 1991, 1992 Linus Torvalds
7 */
9 #include <linux/types.h>
10 #include <linux/string.h>
12 #ifndef __HAVE_ARCH_STRSTR
13 /**
14 * strstr - Find the first substring in a %NUL terminated string
15 * @s1: The string to be searched
16 * @s2: The string to search for
18 char *strstr(const char *s1, const char *s2)
20 size_t l1, l2;
22 l2 = strlen(s2);
23 if (!l2)
24 return (char *)s1;
25 l1 = strlen(s1);
26 while (l1 >= l2) {
27 l1--;
28 if (!memcmp(s1, s2, l2))
29 return (char *)s1;
30 s1++;
32 return NULL;
34 #endif
36 #ifndef __HAVE_ARCH_STRNCMP
37 /**
38 * strncmp - Compare two length-limited strings
39 * @cs: One string
40 * @ct: Another string
41 * @count: The maximum number of bytes to compare
43 int strncmp(const char *cs, const char *ct, size_t count)
45 unsigned char c1, c2;
47 while (count) {
48 c1 = *cs++;
49 c2 = *ct++;
50 if (c1 != c2)
51 return c1 < c2 ? -1 : 1;
52 if (!c1)
53 break;
54 count--;
56 return 0;
58 #endif