Update Function Object interface

to make interface trivially copiable

There is no need to perform a copy-protected type as there is no init/clear for this type.
It is always created through an instance.
This commit is contained in:
Patrick Pelissier committed 2023-12-09 12:40:45 +01:00
1 parent 15492394ad
commit 7bf3ea3a87
3 files changed
+9 -5

No files matched your search

+4 -2
View File
@@ -85,7 +85,8 @@ static void test_instance11(void)
instance11_t cmp;
int n = 2;
instance11_init_with(cmp, -1, STRING_CTE("INIT") );
int x = interface1_call(instance11_as_interface(cmp), 10, &n);
interface1_t interface = instance11_as_interface(cmp);
int x = interface1_call(interface, 10, &n);
assert(x == -8);
assert(string_equal_str_p(cmp->c, "CALLED"));
instance11_clear(cmp);
@@ -111,7 +112,8 @@ static void test_instance21(void)
{
instance21_t cmp;
instance21_init(cmp);
int x = interface2_call(instance21_as_interface(cmp));
interface2_t interface = instance21_as_interface(cmp);
int x = interface2_call(interface);
assert(x == 1);
instance21_clear(cmp);
}