1.1 --- a/templates/progops.c Sun Nov 27 22:47:09 2016 +0100
1.2 +++ b/templates/progops.c Sun Nov 27 22:48:35 2016 +0100
1.3 @@ -14,7 +14,7 @@
1.4
1.5 __attr __new(const __table * table, __ref cls, size_t size)
1.6 {
1.7 - __ref obj = (__ref) calloc(1, size);
1.8 + __ref obj = (__ref) __ALLOCATE(1, size);
1.9 __attr self = {obj, obj};
1.10 __attr tmp = {0, cls};
1.11 obj->table = table;
1.12 @@ -28,7 +28,7 @@
1.13 {
1.14 /* Calculate the size of the fragment. */
1.15
1.16 - __fragment *data = (__fragment *) calloc(1, __FRAGMENT_SIZE(number));
1.17 + __fragment *data = (__fragment *) __ALLOCATE(1, __FRAGMENT_SIZE(number));
1.18 __attr attr = {0, .data=data};
1.19 unsigned int i, j;
1.20
1.21 @@ -51,6 +51,15 @@
1.22 __Raise(exc);
1.23 }
1.24
1.25 +/* A helper for raising memory errors within common operations. */
1.26 +
1.27 +void __raise_memory_error()
1.28 +{
1.29 + __attr args[1];
1.30 + __attr exc = __MEMORY_ERROR_INSTANTIATOR(args);
1.31 + __Raise(exc);
1.32 +}
1.33 +
1.34 /* Generic invocation operations. */
1.35
1.36 /* Invoke the given callable, supplying keyword argument details in the given