1.1 --- a/templates/ops.c Sat Oct 29 22:46:20 2016 +0200
1.2 +++ b/templates/ops.c Sat Oct 29 22:56:23 2016 +0200
1.3 @@ -1,5 +1,6 @@
1.4 /* Common operations. */
1.5
1.6 +#include <stdlib.h>
1.7 #include "ops.h"
1.8 #include "progconsts.h"
1.9 #include "progtypes.h"
1.10 @@ -218,3 +219,12 @@
1.11 {
1.12 return obj->pos;
1.13 }
1.14 +
1.15 +/* Copying of structures. */
1.16 +
1.17 +__ref __COPY(__ref obj, int size)
1.18 +{
1.19 + __ref copy = calloc(1, size);
1.20 + memcpy(copy, obj, size);
1.21 + return copy;
1.22 +}