datapath-windows: add OvsCompareString() to compare strings
authorNithin Raju <nithin@vmware.com>
Fri, 19 Sep 2014 21:30:53 +0000 (14:30 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 19 Sep 2014 21:36:55 +0000 (14:36 -0700)
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 <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows/ovsext/Util.c
datapath-windows/ovsext/Util.h

index 51360a8..2dfba8e 100644 (file)
@@ -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);
+}
index c45d488..e752209 100644 (file)
@@ -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_ */