# HG changeset patch # User Paul Boddie # Date 1486858893 -3600 # Node ID afe747e589b31538af82eeea8ebb56cef6e0d7f0 # Parent b09f64a52daae4339ce007e5a3253c95b7a5c67f Made use of instantiation convenience macros. diff -r b09f64a52daa -r afe747e589b3 templates/native/common.c --- a/templates/native/common.c Sun Feb 12 00:25:36 2017 +0100 +++ b/templates/native/common.c Sun Feb 12 01:21:33 2017 +0100 @@ -1,6 +1,6 @@ /* Common operations for native functions. -Copyright (C) 2016 Paul Boddie +Copyright (C) 2016, 2017 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 @@ -29,7 +29,7 @@ __attr __new_int(int i) { /* Create a new integer and mutate the __data__ attribute. */ - __attr attr = __new(&__InstanceTable___builtins___int_int, &__builtins___int_int, sizeof(__obj___builtins___int_int)); + __attr attr = __NEWINSTANCE(__builtins___int_int); attr.value->attrs[__pos___data__].intvalue = i; return attr; } @@ -37,7 +37,7 @@ __attr __new_str(char *s, size_t size) { /* Create a new string and mutate the __data__ and __key__ attributes. */ - __attr attr = __new(&__InstanceTable___builtins___str_string, &__builtins___str_string, sizeof(__obj___builtins___str_string)); + __attr attr = __NEWINSTANCE(__builtins___str_string); attr.value->attrs[__pos___data__].size = size; attr.value->attrs[__pos___data__].strvalue = s; attr.value->attrs[__pos___key__] = __NULL; @@ -47,7 +47,7 @@ __attr __new_list(__fragment *f) { /* Create a new list and mutate the __data__ attribute. */ - __attr attr = __new(&__InstanceTable___builtins___list_list, &__builtins___list_list, sizeof(__obj___builtins___list_list)); + __attr attr = __NEWINSTANCE(__builtins___list_list); attr.value->attrs[__pos___data__].seqvalue = f; return attr; }