Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename TSK_TAKE_TABLES to TSK_TAKE_OWNERSHIP #2222

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions c/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
5 changes: 4 additions & 1 deletion c/tskit/tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() */
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions c/tskit/trees.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down