From 964eed7331c807e553ec42637151fda21b5495d9 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 28 Jun 2016 15:37:43 -0400 Subject: string functions: added __ntapi_tt_strncmp_multibyte(). --- src/string/ntapi_tt_strncmp_multibyte.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/string/ntapi_tt_strncmp_multibyte.c (limited to 'src/string') diff --git a/src/string/ntapi_tt_strncmp_multibyte.c b/src/string/ntapi_tt_strncmp_multibyte.c new file mode 100644 index 0000000..d66865d --- /dev/null +++ b/src/string/ntapi_tt_strncmp_multibyte.c @@ -0,0 +1,22 @@ +/********************************************************/ +/* ntapi: Native API core library */ +/* Copyright (C) 2013--2016 Z. Gilboa */ +/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */ +/********************************************************/ + +#include +#include + +int __cdecl __ntapi_tt_strncmp_multibyte( + __in const char * a, + __in const char * b, + __in size_t n) +{ + if (n == 0) + return 0; + + for (--n; n && (*a == *b) && *a; a++, b++) + n--; + + return (int)*a - (int)*b; +} -- cgit v1.2.3