blob: 1480f58c2eb4fb4fdc258c224548d9256b13010d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#include <xen/string.h>
/**
* strncmp - Compare two length-limited strings
* @cs: One string
* @ct: Another string
* @count: The maximum number of bytes to compare
*/
int (strncmp)(const char *cs, const char *ct, size_t count)
{
unsigned char *csu = (unsigned char *)cs;
unsigned char *ctu = (unsigned char *)ct;
int res = 0;
while (count) {
if ((res = *csu - *ctu++) != 0 || !*csu++)
break;
count--;
}
return res;
}
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*/
|