Nithin, I don't think there's a need to implement such a function. You can use memcmp, which behaves quite like strncmp.
Regards, Sam ________________________________________ From: Nithin Raju [nit...@vmware.com] Sent: Wednesday, September 17, 2014 5:06 AM To: dev@openvswitch.org; Samuel Ghinet; elia...@vmware.com; ankursha...@vmware.com Cc: Nithin Raju Subject: [PATCH 2/5 v1] datapath-windows: add OvsComareString() to compare strings Turns out that there's no convenient equivalent of strncmp() in the Windows kernel. RtlEqualString() works on STRING * pointers which are different from the CHAR * pointers. In this patch, we add support for such a function for comparing strings. Signed-off-by: Nithin Raju <nit...@vmware.com> --- datapath-windows/ovsext/Util.c | 12 ++++++++++++ datapath-windows/ovsext/Util.h | 3 +++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/datapath-windows/ovsext/Util.c b/datapath-windows/ovsext/Util.c index 51360a8..be2b829 100644 --- a/datapath-windows/ovsext/Util.c +++ b/datapath-windows/ovsext/Util.c @@ -87,3 +87,15 @@ OvsAppendList(PLIST_ENTRY dst, PLIST_ENTRY src) src->Flink = src; src->Blink = src; } + +BOOLEAN +OvsCompareString(PVOID string1, UINT32 size1, + PVOID string2, UINT32 size2) +{ + if (size1 == size2 && + RtlCompareMemory(string1, string2, size1) == size1) { + return TRUE; + } + + return FALSE; +} diff --git a/datapath-windows/ovsext/Util.h b/datapath-windows/ovsext/Util.h index c45d488..3e21af6 100644 --- a/datapath-windows/ovsext/Util.h +++ b/datapath-windows/ovsext/Util.h @@ -75,4 +75,7 @@ VOID OvsAppendList(PLIST_ENTRY dst, PLIST_ENTRY src); #define BIT16(_x) ((UINT16)0x1 << (_x)) #define BIT32(_x) ((UINT32)0x1 << (_x)) +BOOLEAN OvsCompareString(PVOID string1, UINT32 size1, + PVOID string2, UINT32 size2); + #endif /* __UTIL_H_ */ -- 1.7.4.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev