summaryrefslogtreecommitdiffhomepage
path: root/src/string
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-06-28 15:37:43 -0400
committermidipix <writeonce@midipix.org>2016-06-28 19:46:40 -0400
commit964eed7331c807e553ec42637151fda21b5495d9 (patch)
tree391ff6c01b0e93a87f8ad9c11fa2a9bdd6f29b50 /src/string
parent060eadf4e7f81c2d2da4f6c4b2f019186c47ec57 (diff)
downloadntapi-964eed7331c807e553ec42637151fda21b5495d9.tar.bz2
ntapi-964eed7331c807e553ec42637151fda21b5495d9.tar.xz
string functions: added __ntapi_tt_strncmp_multibyte().
Diffstat (limited to 'src/string')
-rw-r--r--src/string/ntapi_tt_strncmp_multibyte.c22
1 files changed, 22 insertions, 0 deletions
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 <psxtypes/psxtypes.h>
+#include <ntapi/nt_string.h>
+
+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;
+}