In this patch we implement a utility function to compare ANSI
strings using the Rtl* functions. As much as possible, in an
NDIS driver, we stick to Rtl* functions for memory/string
manipulation.

Signed-off-by: Nithin Raju <nit...@vmware.com>
---
 datapath-windows/ovsext/Util.c |   14 ++++++++++++++
 datapath-windows/ovsext/Util.h |    2 ++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/datapath-windows/ovsext/Util.c b/datapath-windows/ovsext/Util.c
index 51360a8..2dfba8e 100644
--- a/datapath-windows/ovsext/Util.c
+++ b/datapath-windows/ovsext/Util.c
@@ -87,3 +87,17 @@ OvsAppendList(PLIST_ENTRY dst, PLIST_ENTRY src)
     src->Flink = src;
     src->Blink = src;
 }
+
+BOOLEAN
+OvsCompareString(PVOID string1, PVOID string2)
+{
+    /*
+     * Not a super-efficient string compare since we walk over the strings
+     * twice: to initialize, and then to do the comparison.
+     */
+    STRING str1, str2;
+
+    RtlInitString(&str1, string1);
+    RtlInitString(&str2, string2);
+    return RtlEqualString(&str1, &str2, FALSE);
+}
diff --git a/datapath-windows/ovsext/Util.h b/datapath-windows/ovsext/Util.h
index c45d488..e752209 100644
--- a/datapath-windows/ovsext/Util.h
+++ b/datapath-windows/ovsext/Util.h
@@ -75,4 +75,6 @@ VOID OvsAppendList(PLIST_ENTRY dst, PLIST_ENTRY src);
 #define BIT16(_x)                       ((UINT16)0x1 << (_x))
 #define BIT32(_x)                       ((UINT32)0x1 << (_x))
 
+BOOLEAN OvsCompareString(PVOID string1, PVOID string2);
+
 #endif /* __UTIL_H_ */
-- 
1.7.4.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to