1.1 --- a/templates/native/int.c Sun Feb 12 23:24:42 2017 +0100
1.2 +++ b/templates/native/int.c Mon Feb 13 18:54:59 2017 +0100
1.3 @@ -18,8 +18,9 @@
1.4
1.5 #include <limits.h> /* INT_MAX, INT_MIN */
1.6 #include <math.h> /* ceil, log10, pow */
1.7 -#include <stdio.h> /* fdopen, snprintf, strlen */
1.8 +#include <stdio.h> /* fdopen, snprintf */
1.9 #include <errno.h> /* errno */
1.10 +#include <string.h> /* strlen */
1.11 #include "native/common.h"
1.12 #include "types.h"
1.13 #include "exceptions.h"
1.14 @@ -31,6 +32,13 @@
1.15
1.16 /* Integer operations. */
1.17
1.18 +__attr __fn_native_int_int_new(__attr __args[])
1.19 +{
1.20 + __attr * const _data = &__args[1];
1.21 +
1.22 + return __new_int(_data->intvalue);
1.23 +}
1.24 +
1.25 __attr __fn_native_int_int_add(__attr __args[])
1.26 {
1.27 __attr * const _data = &__args[1];
1.28 @@ -268,7 +276,7 @@
1.29 snprintf(s, n, "%d", i);
1.30
1.31 /* Return a new string. */
1.32 - return __new_str(s);
1.33 + return __new_str(s, strlen(s));
1.34 }
1.35
1.36 /* Module initialisation. */