Browse Source

[libc] Remove unused string functions

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
b54167b8b6
2 changed files with 0 additions and 194 deletions
  1. 0
    188
      src/core/stringextra.c
  2. 0
    6
      src/include/string.h

+ 0
- 188
src/core/stringextra.c View File

@@ -38,122 +38,6 @@ FILE_LICENCE ( GPL2_ONLY );
38 38
 
39 39
 /* *** FROM string.c *** */
40 40
 
41
-#ifndef __HAVE_ARCH_STRNICMP
42
-/**
43
- * strnicmp - Case insensitive, length-limited string comparison
44
- * @s1: One string
45
- * @s2: The other string
46
- * @len: the maximum number of characters to compare
47
- */
48
-int strnicmp(const char *s1, const char *s2, size_t len)
49
-{
50
-	/* Yes, Virginia, it had better be unsigned */
51
-	unsigned char c1, c2;
52
-
53
-	c1 = 0;	c2 = 0;
54
-	if (len) {
55
-		do {
56
-			c1 = *s1; c2 = *s2;
57
-			s1++; s2++;
58
-			if (!c1)
59
-				break;
60
-			if (!c2)
61
-				break;
62
-			if (c1 == c2)
63
-				continue;
64
-			c1 = tolower(c1);
65
-			c2 = tolower(c2);
66
-			if (c1 != c2)
67
-				break;
68
-		} while (--len);
69
-	}
70
-	return (int)c1 - (int)c2;
71
-}
72
-#endif
73
-
74
-char * ___strtok;
75
-
76
-#ifndef __HAVE_ARCH_STRNCAT
77
-/**
78
- * strncat - Append a length-limited, %NUL-terminated string to another
79
- * @dest: The string to be appended to
80
- * @src: The string to append to it
81
- * @count: The maximum numbers of bytes to copy
82
- *
83
- * Note that in contrast to strncpy, strncat ensures the result is
84
- * terminated.
85
- */
86
-char * strncat(char *dest, const char *src, size_t count)
87
-{
88
-	char *tmp = dest;
89
-
90
-	if (count) {
91
-		while (*dest)
92
-			dest++;
93
-		while ((*dest++ = *src++)) {
94
-			if (--count == 0) {
95
-				*dest = '\0';
96
-				break;
97
-			}
98
-		}
99
-	}
100
-
101
-	return tmp;
102
-}
103
-#endif
104
-
105
-#ifndef __HAVE_ARCH_STRSPN
106
-/**
107
- * strspn - Calculate the length of the initial substring of @s which only
108
- * 	contain letters in @accept
109
- * @s: The string to be searched
110
- * @accept: The string to search for
111
- */
112
-size_t strspn(const char *s, const char *accept)
113
-{
114
-	const char *p;
115
-	const char *a;
116
-	size_t count = 0;
117
-
118
-	for (p = s; *p != '\0'; ++p) {
119
-		for (a = accept; *a != '\0'; ++a) {
120
-			if (*p == *a)
121
-				break;
122
-		}
123
-		if (*a == '\0')
124
-			return count;
125
-		++count;
126
-	}
127
-
128
-	return count;
129
-}
130
-#endif
131
-
132
-#ifndef __HAVE_ARCH_STRCSPN
133
-/**
134
- * strcspn - Calculate the length of the initial substring of @s which only
135
- * 	contain letters not in @reject
136
- * @s: The string to be searched
137
- * @accept: The string to search for
138
- */
139
-size_t strcspn(const char *s, const char *reject)
140
-{
141
-	const char *p;
142
-	const char *r;
143
-	size_t count = 0;
144
-
145
-	for (p = s; *p != '\0'; ++p) {
146
-		for (r = reject; *r != '\0'; ++r) {
147
-			if (*p == *r)
148
-				return count;
149
-		}
150
-		++count;
151
-	}
152
-
153
-	return count;
154
-}
155
-#endif
156
-
157 41
 #ifndef __HAVE_ARCH_STRPBRK
158 42
 /**
159 43
  * strpbrk - Find the first occurrence of a set of characters
@@ -174,35 +58,6 @@ char * strpbrk(const char * cs,const char * ct)
174 58
 }
175 59
 #endif
176 60
 
177
-#ifndef __HAVE_ARCH_STRTOK
178
-/**
179
- * strtok - Split a string into tokens
180
- * @s: The string to be searched
181
- * @ct: The characters to search for
182
- *
183
- * WARNING: strtok is deprecated, use strsep instead.
184
- */
185
-char * strtok(char * s,const char * ct)
186
-{
187
-	char *sbegin, *send;
188
-
189
-	sbegin  = s ? s : ___strtok;
190
-	if (!sbegin) {
191
-		return NULL;
192
-	}
193
-	sbegin += strspn(sbegin,ct);
194
-	if (*sbegin == '\0') {
195
-		___strtok = NULL;
196
-		return( NULL );
197
-	}
198
-	send = strpbrk( sbegin, ct);
199
-	if (send && *send != '\0')
200
-		*send++ = '\0';
201
-	___strtok = send;
202
-	return (sbegin);
203
-}
204
-#endif
205
-
206 61
 #ifndef __HAVE_ARCH_STRSEP
207 62
 /**
208 63
  * strsep - Split a string into tokens
@@ -230,46 +85,3 @@ char * strsep(char **s, const char *ct)
230 85
 	return sbegin;
231 86
 }
232 87
 #endif
233
-
234
-#ifndef __HAVE_ARCH_BCOPY
235
-/**
236
- * bcopy - Copy one area of memory to another
237
- * @src: Where to copy from
238
- * @dest: Where to copy to
239
- * @count: The size of the area.
240
- *
241
- * Note that this is the same as memcpy(), with the arguments reversed.
242
- * memcpy() is the standard, bcopy() is a legacy BSD function.
243
- *
244
- * You should not use this function to access IO space, use memcpy_toio()
245
- * or memcpy_fromio() instead.
246
- */
247
-char * bcopy(const char * src, char * dest, int count)
248
-{
249
-	return memmove(dest,src,count);
250
-}
251
-#endif
252
-
253
-#ifndef __HAVE_ARCH_MEMSCAN
254
-/**
255
- * memscan - Find a character in an area of memory.
256
- * @addr: The memory area
257
- * @c: The byte to search for
258
- * @size: The size of the area.
259
- *
260
- * returns the address of the first occurrence of @c, or 1 byte past
261
- * the area if @c is not found
262
- */
263
-void * memscan(const void * addr, int c, size_t size)
264
-{
265
-	unsigned char * p = (unsigned char *) addr;
266
-
267
-	while (size) {
268
-		if (*p == c)
269
-			return (void *) p;
270
-		p++;
271
-		size--;
272
-	}
273
-  	return (void *) p;
274
-}
275
-#endif

+ 0
- 6
src/include/string.h View File

@@ -19,11 +19,9 @@ FILE_LICENCE ( GPL2_ONLY );
19 19
 #include <stddef.h>
20 20
 #include <bits/string.h>
21 21
 
22
-int __pure strnicmp(const char *s1, const char *s2, size_t len) __nonnull;
23 22
 char * strcpy(char * dest,const char *src) __nonnull;
24 23
 char * strncpy(char * dest,const char *src,size_t count) __nonnull;
25 24
 char * strcat(char * dest, const char * src) __nonnull;
26
-char * strncat(char *dest, const char *src, size_t count) __nonnull;
27 25
 int __pure strcmp(const char * cs,const char * ct) __nonnull;
28 26
 int __pure strncmp(const char * cs,const char * ct,
29 27
 				     size_t count) __nonnull;
@@ -31,17 +29,13 @@ char * __pure strchr(const char * s, int c) __nonnull;
31 29
 char * __pure strrchr(const char * s, int c) __nonnull;
32 30
 size_t __pure strlen(const char * s) __nonnull;
33 31
 size_t __pure strnlen(const char * s, size_t count) __nonnull;
34
-size_t __pure strspn(const char *s, const char *accept) __nonnull;
35
-size_t __pure strcspn(const char *s, const char *reject) __nonnull;
36 32
 char * __pure strpbrk(const char * cs,const char * ct) __nonnull;
37
-char * strtok(char * s,const char * ct) __nonnull;
38 33
 char * strsep(char **s, const char *ct) __nonnull;
39 34
 void * memset(void * s,int c,size_t count) __nonnull;
40 35
 void * memcpy ( void *dest, const void *src, size_t len ) __nonnull;
41 36
 void * memmove(void * dest,const void *src,size_t count) __nonnull;
42 37
 int __pure memcmp(const void * cs,const void * ct,
43 38
 				    size_t count) __nonnull;
44
-void * __pure memscan(const void * addr, int c, size_t size) __nonnull;
45 39
 char * __pure strstr(const char * s1,const char * s2) __nonnull;
46 40
 void * __pure memchr(const void *s, int c, size_t n) __nonnull;
47 41
 char * __malloc strdup(const char *s) __nonnull;

Loading…
Cancel
Save