1.1 --- a/templates/native/common.c Wed Jul 11 23:52:05 2018 +0200
1.2 +++ b/templates/native/common.c Wed Jul 11 23:53:09 2018 +0200
1.3 @@ -1,6 +1,6 @@
1.4 /* Common operations for native functions.
1.5
1.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk>
1.7 +Copyright (C) 2016, 2017, 2018 Paul Boddie <paul@boddie.org.uk>
1.8
1.9 This program is free software; you can redistribute it and/or modify it under
1.10 the terms of the GNU General Public License as published by the Free Software
1.11 @@ -30,9 +30,9 @@
1.12 {
1.13 /* Create a new string and mutate the __data__, __size__ and __key__ attributes. */
1.14 __attr attr = __NEWINSTANCE(__builtins___str_string);
1.15 - attr.value->attrs[__ATTRPOS(__data__)].strvalue = s;
1.16 - attr.value->attrs[__ATTRPOS(__size__)] = __INTVALUE(size);
1.17 - attr.value->attrs[__ATTRPOS(__key__)] = __NULL;
1.18 + __store_via_object(__VALUE(attr), __data__, (__attr) {.strvalue=s});
1.19 + __store_via_object(__VALUE(attr), __size__, __INTVALUE(size));
1.20 + __store_via_object(__VALUE(attr), __key__, __NULL);
1.21 return attr;
1.22 }
1.23
1.24 @@ -40,7 +40,7 @@
1.25 {
1.26 /* Create a new list and mutate the __data__ attribute. */
1.27 __attr attr = __NEWINSTANCE(__builtins___list_list);
1.28 - attr.value->attrs[__ATTRPOS(__data__)].seqvalue = f;
1.29 + __store_via_object(__VALUE(attr), __data__, (__attr) {.seqvalue=f});
1.30 return attr;
1.31 }
1.32