[cvsnt] PATCH - more readable RootOverlaps()
Alexey Panchenko
alexey-panchenko at hotmail.ru
Wed Mar 2 05:28:58 GMT 2005
Hello !
I think this implementation is more readable.
Index: LockParse.cpp
===================================================================
RCS file: /usr/local/cvs/cvsnt/lockservice/LockParse.cpp,v
retrieving revision 1.15
diff -u -r1.15 LockParse.cpp
--- LockParse.cpp 9 Feb 2005 15:30:47 -0000 1.15
+++ LockParse.cpp 2 Mar 2005 04:25:23 -0000
@@ -210,10 +210,8 @@
bool RootOverlaps(size_t client, std::string& root1, std::string& root2)
{
- if(root1.length()>root2.length())
- return LockClientMap[client].fnncmp(root1.c_str(),root2.c_str(),root2.length())?false:true;
- else
- return LockClientMap[client].fnncmp(root1.c_str(),root2.c_str(),root1.length())?false:true;
+ size_t minLength = min(root1.length(), root2.length());
+ return LockClientMap[client].fnncmp(root1.c_str(), root2.c_str(), minLength) ? false : true;
}
--
Best regards,
Alexey mailto:alexey-panchenko at hotmail.ru
More information about the cvsnt
mailing list