1.1 --- a/templates/native/iconv.c Sat Nov 06 17:06:01 2021 +0100
1.2 +++ b/templates/native/iconv.c Sun Nov 07 01:18:51 2021 +0100
1.3 @@ -33,20 +33,20 @@
1.4 static void __raise_incomplete_sequence_error(__attr value, __attr arg)
1.5 {
1.6 #ifdef __HAVE_posix_iconv_IncompleteSequenceError
1.7 - __Raise(__new_posix_iconv_IncompleteSequenceError(__NULL, value, arg));
1.8 + __Raise(__new_posix_iconv_IncompleteSequenceError(__NULL, __NULL, value, arg));
1.9 #endif /* __HAVE_posix_iconv_IncompleteSequenceError */
1.10 }
1.11
1.12 static void __raise_invalid_sequence_error(__attr value, __attr arg)
1.13 {
1.14 #ifdef __HAVE_posix_iconv_InvalidSequenceError
1.15 - __Raise(__new_posix_iconv_InvalidSequenceError(__NULL, value, arg));
1.16 + __Raise(__new_posix_iconv_InvalidSequenceError(__NULL, __NULL, value, arg));
1.17 #endif /* __HAVE_posix_iconv_InvalidSequenceError */
1.18 }
1.19
1.20 /* Character set conversion. */
1.21
1.22 -__attr __fn_native_iconv_iconv(__attr __self, __attr cd, __attr state)
1.23 +__attr __fn_native_iconv_iconv(__attr __stack, __attr __self, __attr cd, __attr state)
1.24 {
1.25 /* cd interpreted as iconv_t */
1.26 iconv_t c = (iconv_t) cd.datavalue;
1.27 @@ -87,13 +87,13 @@
1.28
1.29 /* Mutate the state to indicate the next input buffer position. */
1.30
1.31 - f->attrs[1] = __new_int(start + remaining - inbytesleft);
1.32 - f->attrs[2] = __new_int(inbytesleft);
1.33 + f->attrs[1] = __new_int(__stack, start + remaining - inbytesleft);
1.34 + f->attrs[2] = __new_int(__stack, inbytesleft);
1.35
1.36 /* Incomplete sequence: raise the string in an OSError instead. */
1.37
1.38 if (errno == EINVAL)
1.39 - __raise_incomplete_sequence_error(__new_int(errno), __new_str(resultbuf, outbytestotal));
1.40 + __raise_incomplete_sequence_error(__new_int(__stack, errno), __new_str(resultbuf, outbytestotal));
1.41
1.42 return __new_str(resultbuf, outbytestotal);
1.43 }
1.44 @@ -104,20 +104,20 @@
1.45 {
1.46 resultbuf = __ALLOCATE(inbytesleft + 1, sizeof(char));
1.47 memcpy(resultbuf, inbuf, inbytesleft);
1.48 - __raise_invalid_sequence_error(__new_int(errno), __new_str(resultbuf, inbytesleft));
1.49 + __raise_invalid_sequence_error(__new_int(__stack, errno), __new_str(resultbuf, inbytesleft));
1.50 }
1.51
1.52 /* General failure. */
1.53
1.54 else
1.55 - __raise_os_error(__new_int(errno), __builtins___none_None);
1.56 + __raise_os_error(__new_int(__stack, errno), __builtins___none_None);
1.57
1.58 /* Should never be reached: included to satisfy the compiler. */
1.59
1.60 return __builtins___none_None;
1.61 }
1.62
1.63 -__attr __fn_native_iconv_iconv_close(__attr __self, __attr cd)
1.64 +__attr __fn_native_iconv_iconv_close(__attr __stack, __attr __self, __attr cd)
1.65 {
1.66 /* cd interpreted as iconv_t */
1.67 iconv_t c = (iconv_t) cd.datavalue;
1.68 @@ -125,12 +125,12 @@
1.69 errno = 0;
1.70
1.71 if (iconv_close(c) == -1)
1.72 - __raise_os_error(__new_int(errno), __builtins___none_None);
1.73 + __raise_os_error(__new_int(__stack, errno), __builtins___none_None);
1.74
1.75 return __builtins___none_None;
1.76 }
1.77
1.78 -__attr __fn_native_iconv_iconv_open(__attr __self, __attr tocode, __attr fromcode)
1.79 +__attr __fn_native_iconv_iconv_open(__attr __stack, __attr __self, __attr tocode, __attr fromcode)
1.80 {
1.81 /* tocode.__data__ interpreted as string */
1.82 char *t = __load_via_object(__VALUE(tocode), __data__).strvalue;
1.83 @@ -143,7 +143,7 @@
1.84 result = iconv_open(t, f);
1.85
1.86 if (result == (iconv_t) -1)
1.87 - __raise_os_error(__new_int(errno), __builtins___none_None);
1.88 + __raise_os_error(__new_int(__stack, errno), __builtins___none_None);
1.89
1.90 /* Return the descriptor as an opaque value. */
1.91
1.92 @@ -151,7 +151,7 @@
1.93 return attr;
1.94 }
1.95
1.96 -__attr __fn_native_iconv_iconv_reset(__attr __self, __attr cd)
1.97 +__attr __fn_native_iconv_iconv_reset(__attr __stack, __attr __self, __attr cd)
1.98 {
1.99 /* cd interpreted as iconv_t */
1.100 iconv_t c = (iconv_t) cd.datavalue;