# HG changeset patch # User Paul Boddie # Date 1484072516 -3600 # Node ID ea667043fcfd6b4a0342911fbd0855bf95d8a914 # Parent c78e7e892ee196d19bd36766dad8f786513e06e4 Moved iconv-specific helper functions into the iconv module implementation. diff -r c78e7e892ee1 -r ea667043fcfd templates/native/iconv.c --- a/templates/native/iconv.c Tue Jan 10 19:08:11 2017 +0100 +++ b/templates/native/iconv.c Tue Jan 10 19:21:56 2017 +0100 @@ -30,6 +30,24 @@ static const size_t OUTBUFSIZE_MIN = 16; +static void __raise_incomplete_sequence_error(__attr value, __attr arg) +{ +#ifdef __HAVE_posix_iconv_IncompleteSequenceError + __attr args[3] = {{0, 0}, value, arg}; + __attr exc = __new_posix_iconv_IncompleteSequenceError(args); + __Raise(exc); +#endif /* __HAVE_posix_iconv_IncompleteSequenceError */ +} + +static void __raise_invalid_sequence_error(__attr value, __attr arg) +{ +#ifdef __HAVE_posix_iconv_InvalidSequenceError + __attr args[3] = {{0, 0}, value, arg}; + __attr exc = __new_posix_iconv_InvalidSequenceError(args); + __Raise(exc); +#endif /* __HAVE_posix_iconv_InvalidSequenceError */ +} + /* Character set conversion. */ __attr __fn_native_iconv_iconv(__attr __args[]) diff -r c78e7e892ee1 -r ea667043fcfd templates/progops.c --- a/templates/progops.c Tue Jan 10 19:08:11 2017 +0100 +++ b/templates/progops.c Tue Jan 10 19:21:56 2017 +0100 @@ -103,24 +103,6 @@ #endif /* __HAVE___builtins___exception_io_EOFError */ } -void __raise_incomplete_sequence_error(__attr value, __attr arg) -{ -#ifdef __HAVE_posix_iconv_IncompleteSequenceError - __attr args[3] = {{0, 0}, value, arg}; - __attr exc = __new_posix_iconv_IncompleteSequenceError(args); - __Raise(exc); -#endif /* __HAVE_posix_iconv_IncompleteSequenceError */ -} - -void __raise_invalid_sequence_error(__attr value, __attr arg) -{ -#ifdef __HAVE_posix_iconv_InvalidSequenceError - __attr args[3] = {{0, 0}, value, arg}; - __attr exc = __new_posix_iconv_InvalidSequenceError(args); - __Raise(exc); -#endif /* __HAVE_posix_iconv_InvalidSequenceError */ -} - void __raise_io_error(__attr value) { #ifdef __HAVE___builtins___exception_io_IOError diff -r c78e7e892ee1 -r ea667043fcfd templates/progops.h --- a/templates/progops.h Tue Jan 10 19:08:11 2017 +0100 +++ b/templates/progops.h Tue Jan 10 19:21:56 2017 +0100 @@ -40,10 +40,6 @@ void __raise_eof_error(); -void __raise_incomplete_sequence_error(__attr value, __attr arg); - -void __raise_invalid_sequence_error(__attr value, __attr arg); - void __raise_io_error(__attr value); void __raise_memory_error();