to deal with the fact that the public headers may be used with pre-c99 compilers, __restrict is used in place of restrict, and defined appropriately for any supported compiler. we also avoid the form [restrict] since older versions of gcc rejected it due to a bug in the original c99 standard, and instead use the form *restrict.
19 lines
405 B
C
19 lines
405 B
C
/*
|
|
* This code was written by Rich Felker in 2010; no copyright is claimed.
|
|
* This code is in the public domain. Attribution is appreciated but
|
|
* unnecessary.
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <inttypes.h>
|
|
#include <wchar.h>
|
|
#include <errno.h>
|
|
|
|
#include "internal.h"
|
|
|
|
size_t wcstombs(char *restrict s, const wchar_t *restrict ws, size_t n)
|
|
{
|
|
const wchar_t * x = ws;
|
|
return wcsrtombs(s, &x, n, 0);
|
|
}
|