diff --git a/c/CHANGELOG.rst b/c/CHANGELOG.rst index 25808efd93..9f8ed69789 100644 --- a/c/CHANGELOG.rst +++ b/c/CHANGELOG.rst @@ -10,6 +10,8 @@ - ``tsk_variant_t`` now includes its ``tsk_site_t`` rather than pointing to it. (:user:`benjeffery`, :issue:`2161`, :pr:`2162`) +- Rename TSK_TAKE_TABLES to TSK_TAKE_OWNERSHIP. + (:user:`benjeffery`, :issue:`2221`, :pr:`2222`) **Features** diff --git a/c/tskit/tables.h b/c/tskit/tables.h index bfbb0c670d..276486efca 100644 --- a/c/tskit/tables.h +++ b/c/tskit/tables.h @@ -689,6 +689,10 @@ typedef struct { /** @brief Do not run integrity checks before performing an operation. */ #define TSK_NO_CHECK_INTEGRITY (1u << 29) +/** @brief Instead of taking a copy of input data, take ownership of it + * and its lifecycle */ +#define TSK_TAKE_OWNERSHIP (1 << 28) + /**@} */ /* Flags for simplify() */ @@ -719,7 +723,6 @@ typedef struct { /* Flags for load tables */ #define TSK_BUILD_INDEXES (1 << 0) -#define TSK_TAKE_TABLES (1 << 1) /* Flags for dump tables */ /* We may not want to document this flag, but it's useful for testing diff --git a/c/tskit/trees.c b/c/tskit/trees.c index 1830e4c666..ba4db3bad8 100644 --- a/c/tskit/trees.c +++ b/c/tskit/trees.c @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2019-2021 Tskit Developers + * Copyright (c) 2019-2022 Tskit Developers * Copyright (c) 2015-2018 University of Oxford * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -405,7 +405,7 @@ tsk_treeseq_init( tsk_id_t num_trees; tsk_memset(self, 0, sizeof(*self)); - if (options & TSK_TAKE_TABLES) { + if (options & TSK_TAKE_OWNERSHIP) { self->tables = tables; } else { self->tables = tsk_malloc(sizeof(*self->tables)); @@ -493,9 +493,9 @@ tsk_treeseq_load(tsk_treeseq_t *self, const char *filename, tsk_flags_t options) tsk_safe_free(tables); goto out; } - /* TSK_TAKE_TABLES takes immediate ownership of the tables, regardless + /* TSK_TAKE_OWNERSHIP takes immediate ownership of the tables, regardless * of error conditions. */ - ret = tsk_treeseq_init(self, tables, TSK_TAKE_TABLES); + ret = tsk_treeseq_init(self, tables, TSK_TAKE_OWNERSHIP); if (ret != 0) { goto out; } @@ -523,9 +523,9 @@ tsk_treeseq_loadf(tsk_treeseq_t *self, FILE *file, tsk_flags_t options) tsk_safe_free(tables); goto out; } - /* TSK_TAKE_TABLES takes immediate ownership of the tables, regardless + /* TSK_TAKE_OWNERSHIP takes immediate ownership of the tables, regardless * of error conditions. */ - ret = tsk_treeseq_init(self, tables, TSK_TAKE_TABLES); + ret = tsk_treeseq_init(self, tables, TSK_TAKE_OWNERSHIP); if (ret != 0) { goto out; }