File: remove-strcasestr.patch

package info (click to toggle)
perdition 2.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,676 kB
  • sloc: ansic: 14,560; sh: 5,274; makefile: 391
file content (68 lines) | stat: -rw-r--r-- 2,519 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--- a/perdition/str.c
+++ b/perdition/str.c
@@ -705,37 +705,6 @@
 }
 
 /**********************************************************************
- * strcasestring
- * Find the first occurrence of string in a string, case insensitively
- * pre: haystack: string to search in
- *      needle: string to search for
- * return: pointer to the first occurrence of needle
- *         NULL on error
- *
- * Note: returns a const char* rather than a char * like strstr().
- *       This seems more logical given the type of the inputs.
- *
- *       strcasestr() exists in gcc (and returns char *) but this
- *       is a GNU extension. As an implementation is needed for when
- *       perdition is compiled against other libcs, it may as be used all
- *       the time.
- **********************************************************************/
-
-const char *strcasestr(const char *haystack, const char *needle)
-{
-	size_t i, haystack_len, needle_len;
-
-	haystack_len = strlen(haystack);
-	needle_len = strlen(needle);
-
-	for (i = 0; haystack_len - i >= needle_len; i++)
-		if (!strcasecmp(haystack + i, needle))
-			return haystack + i;
-
-	return NULL;
-}
-
-/**********************************************************************
  * strcasedelimword
  * Find the first occurrence of a word in a string
  * That is, find a needle in a haystack and make sure that;
--- a/perdition/str.h
+++ b/perdition/str.h
@@ -335,25 +335,6 @@
 char *str_replace(char *str, size_t n, ...);
 
 /**********************************************************************
- * strcasestring
- * Find the first occurrence of string in a string, case insensitively
- * pre: haystack: string to search in
- *      needle: string to search for
- * return: pointer to the first occurrence of needle
- *         NULL on error
- *
- * Note: returns a const char* rather than a char * like strstr().
- *       This seems more logical given the type of the inputs.
- *
- *       strcasestr() exists in gcc (and returns char *) but this
- *       is a GNU extension. As an implementation is needed for when
- *       perdition is compiled against other libcs, it may as be used all
- *       the time.
- **********************************************************************/
-
-const char *strcasestr(const char *haystack, const char *needle);
-
-/**********************************************************************
  * strcasedelimword
  * Find the first occurrence of a word in a string
  * That is, find a needle in a haystack and make sure that;