xen: Infratructure for XEN_TMEM_* hypercalls
[valgrind.git] / memcheck / tests / wcs.c
blob15730ad024689720e86c6b0c039b643ae0b1a09e
1 // Uses various wchar_t * functions that have hand written SSE assembly
2 // implementations in glibc. wcslen, wcscpy, wcscmp, wcsrchr, wcschr.
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <wchar.h>
8 int main(int argc, char **argv)
10 wchar_t a[] = L"The spazzy orange tiger jumped over the tawny jaguar.";
11 wchar_t *b, *c;
12 wchar_t *d, *e;
14 size_t l = wcslen (a);
15 fprintf (stderr, "wcslen: %zd\n", l); // wcslen: 53
17 b = (wchar_t *) malloc((l + 1) * sizeof (wchar_t));
18 c = wcscpy (b, a);
20 fprintf (stderr, "wcscmp equal: %d\n", wcscmp (a, b)); // wcscmp equal: 0
22 d = wcsrchr (a, L'd');
23 e = wcschr (a, L'd');
25 fprintf (stderr, "wcsrchr == wcschr: %d\n", d == e); // wcsrchr == wcschr: 1
27 free (c); // b == c
28 return 0;