diff options
Diffstat (limited to 'arch/x86/boot/string.c')
-rw-r--r-- | arch/x86/boot/string.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c index 3cbc4058dd26..574dedfe2890 100644 --- a/arch/x86/boot/string.c +++ b/arch/x86/boot/string.c | |||
@@ -111,3 +111,38 @@ unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int bas | |||
111 | 111 | ||
112 | return result; | 112 | return result; |
113 | } | 113 | } |
114 | |||
115 | /** | ||
116 | * strlen - Find the length of a string | ||
117 | * @s: The string to be sized | ||
118 | */ | ||
119 | size_t strlen(const char *s) | ||
120 | { | ||
121 | const char *sc; | ||
122 | |||
123 | for (sc = s; *sc != '\0'; ++sc) | ||
124 | /* nothing */; | ||
125 | return sc - s; | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * strstr - Find the first substring in a %NUL terminated string | ||
130 | * @s1: The string to be searched | ||
131 | * @s2: The string to search for | ||
132 | */ | ||
133 | char *strstr(const char *s1, const char *s2) | ||
134 | { | ||
135 | size_t l1, l2; | ||
136 | |||
137 | l2 = strlen(s2); | ||
138 | if (!l2) | ||
139 | return (char *)s1; | ||
140 | l1 = strlen(s1); | ||
141 | while (l1 >= l2) { | ||
142 | l1--; | ||
143 | if (!memcmp(s1, s2, l2)) | ||
144 | return (char *)s1; | ||
145 | s1++; | ||
146 | } | ||
147 | return NULL; | ||
148 | } | ||