# HG changeset patch # User Paul Boddie # Date 1531345989 -7200 # Node ID 81587921b9b4d486a285a2a9df61e5142fffe961 # Parent 6c46f552abec3d4676c05bf9823dbbf161a527f4 Use the __store_via_object operations to set attributes. diff -r 6c46f552abec -r 81587921b9b4 templates/native/common.c --- a/templates/native/common.c Wed Jul 11 23:52:05 2018 +0200 +++ b/templates/native/common.c Wed Jul 11 23:53:09 2018 +0200 @@ -1,6 +1,6 @@ /* Common operations for native functions. -Copyright (C) 2016, 2017 Paul Boddie +Copyright (C) 2016, 2017, 2018 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -30,9 +30,9 @@ { /* Create a new string and mutate the __data__, __size__ and __key__ attributes. */ __attr attr = __NEWINSTANCE(__builtins___str_string); - attr.value->attrs[__ATTRPOS(__data__)].strvalue = s; - attr.value->attrs[__ATTRPOS(__size__)] = __INTVALUE(size); - attr.value->attrs[__ATTRPOS(__key__)] = __NULL; + __store_via_object(__VALUE(attr), __data__, (__attr) {.strvalue=s}); + __store_via_object(__VALUE(attr), __size__, __INTVALUE(size)); + __store_via_object(__VALUE(attr), __key__, __NULL); return attr; } @@ -40,7 +40,7 @@ { /* Create a new list and mutate the __data__ attribute. */ __attr attr = __NEWINSTANCE(__builtins___list_list); - attr.value->attrs[__ATTRPOS(__data__)].seqvalue = f; + __store_via_object(__VALUE(attr), __data__, (__attr) {.seqvalue=f}); return attr; }