Root/
Source at commit fbf123cd4cc0c097fe9a99c90109ebb2a5e94a50 created 10 years 3 months ago. By Lars-Peter Clausen, dma: jz4740: Dequeue descriptor from active list before completing it | |
---|---|
1 | #include <linux/ucs2_string.h> |
2 | #include <linux/module.h> |
3 | |
4 | /* Return the number of unicode characters in data */ |
5 | unsigned long |
6 | ucs2_strnlen(const ucs2_char_t *s, size_t maxlength) |
7 | { |
8 | unsigned long length = 0; |
9 | |
10 | while (*s++ != 0 && length < maxlength) |
11 | length++; |
12 | return length; |
13 | } |
14 | EXPORT_SYMBOL(ucs2_strnlen); |
15 | |
16 | unsigned long |
17 | ucs2_strlen(const ucs2_char_t *s) |
18 | { |
19 | return ucs2_strnlen(s, ~0UL); |
20 | } |
21 | EXPORT_SYMBOL(ucs2_strlen); |
22 | |
23 | /* |
24 | * Return the number of bytes is the length of this string |
25 | * Note: this is NOT the same as the number of unicode characters |
26 | */ |
27 | unsigned long |
28 | ucs2_strsize(const ucs2_char_t *data, unsigned long maxlength) |
29 | { |
30 | return ucs2_strnlen(data, maxlength/sizeof(ucs2_char_t)) * sizeof(ucs2_char_t); |
31 | } |
32 | EXPORT_SYMBOL(ucs2_strsize); |
33 | |
34 | int |
35 | ucs2_strncmp(const ucs2_char_t *a, const ucs2_char_t *b, size_t len) |
36 | { |
37 | while (1) { |
38 | if (len == 0) |
39 | return 0; |
40 | if (*a < *b) |
41 | return -1; |
42 | if (*a > *b) |
43 | return 1; |
44 | if (*a == 0) /* implies *b == 0 */ |
45 | return 0; |
46 | a++; |
47 | b++; |
48 | len--; |
49 | } |
50 | } |
51 | EXPORT_SYMBOL(ucs2_strncmp); |
52 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9