1 /* Charset conversion with out-of-memory checking.
2 Copyright (C) 2009-2018 Free Software Foundation, Inc.
3 Written by Bruno Haible.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program 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
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
21 #include "xstriconveh.h"
25 #include "striconveh.h"
32 xmem_cd_iconveh (const char *src
, size_t srclen
,
34 enum iconv_ilseq_handler handler
,
36 char **resultp
, size_t *lengthp
)
39 mem_cd_iconveh (src
, srclen
, cd
, handler
, offsets
, resultp
, lengthp
);
41 if (retval
< 0 && errno
== ENOMEM
)
47 xstr_cd_iconveh (const char *src
,
49 enum iconv_ilseq_handler handler
)
51 char *result
= str_cd_iconveh (src
, cd
, handler
);
53 if (result
== NULL
&& errno
== ENOMEM
)
61 xmem_iconveh (const char *src
, size_t srclen
,
62 const char *from_codeset
, const char *to_codeset
,
63 enum iconv_ilseq_handler handler
,
65 char **resultp
, size_t *lengthp
)
68 mem_iconveh (src
, srclen
, from_codeset
, to_codeset
, handler
, offsets
,
71 if (retval
< 0 && errno
== ENOMEM
)
77 xstr_iconveh (const char *src
,
78 const char *from_codeset
, const char *to_codeset
,
79 enum iconv_ilseq_handler handler
)
81 char *result
= str_iconveh (src
, from_codeset
, to_codeset
, handler
);
83 if (result
== NULL
&& errno
== ENOMEM
)