diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2021-12-20 23:07:21 +0200 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2021-12-20 23:07:21 +0200 |
commit | 98849f6afb8e216000f6c642d9c9ffa26a58bd4c (patch) | |
tree | b7db94700e7a6b0accac55cba524fbe8b2830056 | |
parent | dbd6366285b23483567f2c1dc814fc9f371c4c64 (diff) | |
download | foodtools-98849f6afb8e216000f6c642d9c9ffa26a58bd4c.tar.gz foodtools-98849f6afb8e216000f6c642d9c9ffa26a58bd4c.tar.bz2 foodtools-98849f6afb8e216000f6c642d9c9ffa26a58bd4c.zip |
Fix distinct sum
-rw-r--r-- | src/types.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/types.c b/src/types.c index 3e720b8..dbc7458 100644 --- a/src/types.c +++ b/src/types.c @@ -330,9 +330,12 @@ distinct_sum_items(recipe * dst, recipe * src) void merge_items(recipe * dst, recipe * src) { - /* Join all items in src's subrecipes to dst */ - join_subrecipe_items(dst, src); - /* Copy src items as well to dst */ - copy_items(dst, src); - distinct_sum_items(dst, dst); + recipe * _r = new_recipe(); + /* Join all items in src's subrecipes to tmp */ + join_subrecipe_items(_r, src); + /* Copy src items as well to tmp */ + copy_items(_r, src); + /* disticnt items to dst */ + distinct_sum_items(dst, _r); + free_recipe(_r); } |