diff options
author | Rich Felker <dalias@aerifal.cx> | 2017-11-10 15:06:42 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2017-11-10 15:06:42 -0500 |
commit | 5b546faa67544af395d6407553762b37e9711157 (patch) | |
tree | 2dea3ba8d23b5cc6c088a364945985f7b046fa75 /src/locale/iconv_close.c | |
parent | 0df5b39a1e9c8aaf480e3f8667d7967e08bbef2b (diff) | |
download | musl-5b546faa67544af395d6407553762b37e9711157.tar.gz musl-5b546faa67544af395d6407553762b37e9711157.tar.xz musl-5b546faa67544af395d6407553762b37e9711157.zip |
add iconv framework for decoding stateful encodings
assuming pointers obtained from malloc have some nonzero alignment, repurpose the low bit of iconv_t as an indicator that the descriptor is a stateless value representing the source and destination character encodings.
Diffstat (limited to 'src/locale/iconv_close.c')
-rw-r--r-- | src/locale/iconv_close.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/locale/iconv_close.c b/src/locale/iconv_close.c index fac681cc..28b29565 100644 --- a/src/locale/iconv_close.c +++ b/src/locale/iconv_close.c @@ -1,6 +1,8 @@ #include <iconv.h> +#include <stdlib.h> int iconv_close(iconv_t cd) { + if (!((size_t)cd & 1)) free((void *)cd); return 0; } |