summarylogtreecommitdiffstats
path: root/0004_URI_contains.patch
blob: 88af945b85bb9cd1e09b3a76064fb84e0598784c (plain)
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
69
70
71
72
73
74
--- a/src/cbang/net/URI.cpp	2023-03-09 11:36:47.000000000 -0500
+++ b/src/cbang/net/URI.cpp	2024-10-09 13:45:02.550052790 -0400
@@ -86,7 +86,7 @@
   }
 
 
-  bool contains(const char *s, char c) {return c && strchr(s, c);}
+  bool my_contains(const char *s, char c) {return c && strchr(s, c);}
 
 
   unsigned portFromScheme(const string &scheme) {
@@ -282,7 +282,7 @@
   string result;
 
   for (unsigned i = 0; i < s.length(); i++)
-    if (contains(unescaped, s[i])) result.append(1, s[i]);
+    if (my_contains(unescaped, s[i])) result.append(1, s[i]);
     else result.append(String::printf("%%%02x", (unsigned)s[i]));
 
   return result;
@@ -331,7 +331,7 @@
   string seg;
 
   while (true)
-    if (contains(PATH_SEGMENT_CHARS, *s)) seg.append(1, *s++);
+    if (my_contains(PATH_SEGMENT_CHARS, *s)) seg.append(1, *s++);
     else if (*s == '%') seg.append(1, parseEscape(s));
     else break;
 
@@ -343,7 +343,7 @@
   if (!isalpha(*s)) THROW("Expected alpha at start of scheme");
 
   while (true)
-    if (contains(SCHEME_CHARS, *s)) scheme.append(1, *s++);
+    if (my_contains(SCHEME_CHARS, *s)) scheme.append(1, *s++);
     else break;
 
   match(s, ':');
@@ -378,7 +378,7 @@
   string result;
 
   while (true)
-    if (contains(USER_PASS_CHARS, *s)) result.append(1, *s++);
+    if (my_contains(USER_PASS_CHARS, *s)) result.append(1, *s++);
     else if (*s == '%') result.append(1, parseEscape(s));
     else break;
 
@@ -394,7 +394,7 @@
 
 void URI::parseHost(const char *&s) {
   while (true)
-    if (contains(HOST_CHARS, *s)) host.append(1, *s++);
+    if (my_contains(HOST_CHARS, *s)) host.append(1, *s++);
     else break;
 
   if (host.empty()) THROW("Expected host character");
@@ -429,7 +429,7 @@
   string result;
 
   while (true)
-    if (contains(NAME_CHARS, *s)) result.append(1, *s++);
+    if (my_contains(NAME_CHARS, *s)) result.append(1, *s++);
     else if (*s == '%') result.append(1, parseEscape(s));
     else break;
 
@@ -443,7 +443,7 @@
   string result;
 
   while (true)
-    if (contains(VALUE_CHARS, *s)) result.append(1, *s++);
+    if (my_contains(VALUE_CHARS, *s)) result.append(1, *s++);
     else if (*s == '%') result.append(1, parseEscape(s));
     else break;