diff options
author | Tim J. Robbins <tjr@FreeBSD.org> | 2004-04-06 13:14:03 +0000 |
---|---|---|
committer | Tim J. Robbins <tjr@FreeBSD.org> | 2004-04-06 13:14:03 +0000 |
commit | 74f90def09fb8e53503cdf5d6548619653ed3580 (patch) | |
tree | 6779dc19a3df61ca545f851748ebd5f5de3a255e /lib/libc/locale/wcstombs.c | |
parent | ed863d3693507683e0d65fab3232b3abe4c2906f (diff) | |
download | src-74f90def09fb8e53503cdf5d6548619653ed3580.tar.gz src-74f90def09fb8e53503cdf5d6548619653ed3580.zip |
Prepare to handle state-dependent encodings. This mainly involves not
taking shortcuts when it comes to storing and passing around conversion
states.
Notes
Notes:
svn path=/head/; revision=127944
Diffstat (limited to 'lib/libc/locale/wcstombs.c')
-rw-r--r-- | lib/libc/locale/wcstombs.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/libc/locale/wcstombs.c b/lib/libc/locale/wcstombs.c index f415aed57aa5..cc5fab46c981 100644 --- a/lib/libc/locale/wcstombs.c +++ b/lib/libc/locale/wcstombs.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002, 2003 Tim J. Robbins. + * Copyright (c) 2002-2004 Tim J. Robbins. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,17 +28,12 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> -#include <string.h> #include <wchar.h> size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n) { + static mbstate_t mbs; - /* - * We pass NULL as the state pointer to wcsrtombs() because we don't - * support state-dependent encodings and don't want to waste time - * creating a zeroed mbstate_t that will not be used. - */ - return (wcsrtombs(s, &pwcs, n, NULL)); + return (wcsrtombs(s, &pwcs, n, &mbs)); } |