aboutsummaryrefslogtreecommitdiff
path: root/dns/powerdns-devel/files/patch-modules_ldapbackend_utils_hh
blob: 6be2a52534e267383b190f67e9e50e30cafb11af (plain) (blame)
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
--- modules/ldapbackend/utils.hh.orig	Sat Apr 23 23:40:15 2005
+++ modules/ldapbackend/utils.hh	Thu Jul 28 09:03:14 2005
@@ -73,7 +73,7 @@
 }
 
 
-inline string ip2ptr4( string ip )
+inline string ip2ptr4( const string& ip )
 {
 	string ptr;
 	vector<string> parts;
@@ -89,7 +89,7 @@
 }
 
 
-inline string ip2ptr6( string ip )
+inline string ip2ptr6( const string& ip )
 {
 	string ptr, part, defstr;
 	vector<string> parts;
@@ -114,6 +114,21 @@
 	}
 
 	return ptr + "ip6.arpa";
+}
+
+
+inline string strbind( const string& search, const string& replace, string subject )
+{
+	size_t pos = 0;
+
+
+	while( ( pos = subject.find( search, pos ) ) != string::npos )
+	{
+		subject.replace( pos, search.size(), replace );
+		pos += replace.size();
+	}
+
+	return subject;
 }
 
 #endif