1 /* Common definitions for open_memstream tests.
2 Copyright (C) 2018-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
26 #include <support/check.h>
31 /* Straighforward implementation so tst-memstream3 could use check
32 fwrite on open_memstream. */
33 static size_t __attribute__ ((used
))
34 fwwrite (const void *ptr
, size_t size
, size_t nmemb
, FILE *arq
)
36 const wchar_t *wcs
= (const wchar_t*) (ptr
);
37 for (size_t s
= 0; s
< size
; s
++)
39 for (size_t n
= 0; n
< nmemb
; n
++)
40 if (fputwc (wcs
[n
], arq
) == WEOF
)
46 # define CHAR_T wchar_t
48 # define OPEN_MEMSTREAM open_wmemstream
49 # define PRINTF wprintf
50 # define FWRITE fwwrite
53 # define STRCMP wcscmp
54 # define STRLEN wcslen
58 # define OPEN_MEMSTREAM open_memstream
59 # define PRINTF printf
60 # define FWRITE fwrite
63 # define STRCMP strcmp
64 # define STRLEN strlen