Skip to content

Commit ead30cd

Browse files
committed
Remove debug stream and TSK_SAMPLE_COUNTS
1 parent f00171d commit ead30cd

File tree

7 files changed

+13
-83
lines changed

7 files changed

+13
-83
lines changed

c/CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
- ``num_tracked_samples`` and ``num_samples`` in ``tsk_tree_t`` are now typed as ``tsk_size_t``
1313
(:user:`benjeffery`, :issue:`1723`, :pr:`1727`)
1414

15+
- The previously deprecated option ``TSK_SAMPLE_COUNTS`` has been removed. (:user:`benjeffery`, :issue:`1744`, :pr:``).
16+
1517
1618
**Features**
1719

c/tests/test_core.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -386,21 +386,6 @@ test_debug_stream(void)
386386
fclose(f);
387387
}
388388

389-
static void
390-
test_warn_stream(void)
391-
{
392-
FILE *f = fopen(_tmp_file_name, "w");
393-
CU_ASSERT_FATAL(tsk_get_warn_stream() == stderr);
394-
CU_ASSERT_FATAL(tsk_get_warn_stream() == stderr);
395-
396-
tsk_set_warn_stream(f);
397-
CU_ASSERT_FATAL(tsk_get_warn_stream() == f);
398-
tsk_set_warn_stream(stderr);
399-
CU_ASSERT_FATAL(tsk_get_warn_stream() == stderr);
400-
401-
fclose(f);
402-
}
403-
404389
static int
405390
validate_avl_node(tsk_avl_node_int_t *node)
406391
{
@@ -552,7 +537,6 @@ main(int argc, char **argv)
552537
{ "test_malloc_zero", test_malloc_zero },
553538
{ "test_malloc_overflow", test_malloc_overflow },
554539
{ "test_debug_stream", test_debug_stream },
555-
{ "test_warn_stream", test_warn_stream },
556540
{ "test_avl_empty", test_avl_empty },
557541
{ "test_avl_sequential", test_avl_sequential },
558542
{ "test_avl_interleaved", test_avl_interleaved },

c/tests/test_trees.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6135,30 +6135,6 @@ test_zero_edges(void)
61356135
tsk_treeseq_free(&tss);
61366136
}
61376137

6138-
static void
6139-
test_sample_counts_deprecated(void)
6140-
{
6141-
tsk_treeseq_t ts;
6142-
tsk_tree_t tree;
6143-
int ret;
6144-
FILE *f = fopen(_tmp_file_name, "w");
6145-
6146-
tsk_treeseq_from_text(&ts, 1, single_tree_ex_nodes, single_tree_ex_edges, NULL, NULL,
6147-
NULL, NULL, NULL, 0);
6148-
CU_ASSERT_EQUAL(tsk_treeseq_get_num_samples(&ts), 4);
6149-
6150-
tsk_set_warn_stream(f);
6151-
ret = tsk_tree_init(&tree, &ts, TSK_SAMPLE_COUNTS);
6152-
tsk_set_warn_stream(stderr);
6153-
CU_ASSERT_EQUAL_FATAL(ret, 0);
6154-
6155-
CU_ASSERT_FATAL(ftell(f) > 0);
6156-
6157-
fclose(f);
6158-
tsk_tree_free(&tree);
6159-
tsk_treeseq_free(&ts);
6160-
}
6161-
61626138
static void
61636139
test_tree_sequence_metadata(void)
61646140
{
@@ -6363,7 +6339,6 @@ main(int argc, char **argv)
63636339
{ "test_deduplicate_sites_multichar", test_deduplicate_sites_multichar },
63646340
{ "test_empty_tree_sequence", test_empty_tree_sequence },
63656341
{ "test_zero_edges", test_zero_edges },
6366-
{ "test_sample_counts_deprecated", test_sample_counts_deprecated },
63676342
{ "test_tree_sequence_metadata", test_tree_sequence_metadata },
63686343

63696344
{ NULL, NULL },

c/tskit/core.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -814,13 +814,12 @@ tsk_memcmp(const void *s1, const void *s2, tsk_size_t size)
814814
return memcmp(s1, s2, (size_t) size);
815815
}
816816

817-
/* We can't initialise the streams to their real default values because
817+
/* We can't initialise the stream to its real default value because
818818
* of limitations on static initialisers. To work around this, we initialise
819-
* them to NULL and then set the value to the required standard stream
819+
* it to NULL and then set the value to the required standard stream
820820
* when called. */
821821

822822
FILE *_tsk_debug_stream = NULL;
823-
FILE *_tsk_warn_stream = NULL;
824823

825824
void
826825
tsk_set_debug_stream(FILE *f)
@@ -837,21 +836,6 @@ tsk_get_debug_stream(void)
837836
return _tsk_debug_stream;
838837
}
839838

840-
void
841-
tsk_set_warn_stream(FILE *f)
842-
{
843-
_tsk_warn_stream = f;
844-
}
845-
846-
FILE *
847-
tsk_get_warn_stream(void)
848-
{
849-
if (_tsk_warn_stream == NULL) {
850-
_tsk_warn_stream = stderr;
851-
}
852-
return _tsk_warn_stream;
853-
}
854-
855839
/* AVL Tree implementation. This is based directly on Knuth's implementation
856840
* in TAOCP. See the python/tests/test_avl_tree.py for more information,
857841
* and equivalent code annotated with the original algorithm listing.

c/tskit/core.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,6 @@ int tsk_memcmp(const void *s1, const void *s2, tsk_size_t size);
512512
/* Developer debug utilities. These are **not** threadsafe */
513513
void tsk_set_debug_stream(FILE *f);
514514
FILE *tsk_get_debug_stream(void);
515-
void tsk_set_warn_stream(FILE *f);
516-
FILE *tsk_get_warn_stream(void);
517515

518516
#ifdef __cplusplus
519517
}

c/tskit/trees.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,12 +3220,6 @@ tsk_tree_init(tsk_tree_t *self, const tsk_treeseq_t *tree_sequence, tsk_flags_t
32203220
ret = TSK_ERR_BAD_PARAM_VALUE;
32213221
goto out;
32223222
}
3223-
if (options & TSK_SAMPLE_COUNTS) {
3224-
fprintf(tsk_get_warn_stream(),
3225-
"TSK_SAMPLE_COUNTS is no longer supported. "
3226-
"Sample counts are tracked by default since 0.99.3, "
3227-
"Please use TSK_NO_SAMPLE_COUNTS to turn off sample counts.");
3228-
}
32293223
num_nodes = tree_sequence->tables->nodes.num_rows;
32303224
num_samples = tree_sequence->num_samples;
32313225
self->num_nodes = num_nodes;

c/tskit/trees.h

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,16 @@ extern "C" {
3636

3737
#include <tskit/tables.h>
3838

39-
/* The TSK_SAMPLE_COUNTS was removed in version 0.99.3, where
40-
* the default is now to always count samples except when
41-
* TSK_NO_SAMPLE_COUNTS is specified. This macro can be undefined
42-
* at some point in the future and the option reused for something
43-
* else. */
44-
// clang-format off
45-
#define TSK_SAMPLE_COUNTS (1 << 0)
46-
#define TSK_SAMPLE_LISTS (1 << 1)
47-
#define TSK_NO_SAMPLE_COUNTS (1 << 2)
48-
49-
#define TSK_STAT_SITE (1 << 0)
50-
#define TSK_STAT_BRANCH (1 << 1)
51-
#define TSK_STAT_NODE (1 << 2)
39+
#define TSK_SAMPLE_LISTS (1 << 1)
40+
#define TSK_NO_SAMPLE_COUNTS (1 << 2)
41+
42+
#define TSK_STAT_SITE (1 << 0)
43+
#define TSK_STAT_BRANCH (1 << 1)
44+
#define TSK_STAT_NODE (1 << 2)
5245

5346
/* Leave room for other stat types */
54-
#define TSK_STAT_POLARISED (1 << 10)
55-
#define TSK_STAT_SPAN_NORMALISE (1 << 11)
47+
#define TSK_STAT_POLARISED (1 << 10)
48+
#define TSK_STAT_SPAN_NORMALISE (1 << 11)
5649

5750
/* Options for map_mutations */
5851
#define TSK_MM_FIXED_ANCESTRAL_STATE (1 << 0)
@@ -61,7 +54,7 @@ extern "C" {
6154
#define TSK_DIR_REVERSE -1
6255

6356
/* For the edge diff iterator */
64-
#define TSK_INCLUDE_TERMINAL (1 << 0)
57+
#define TSK_INCLUDE_TERMINAL (1 << 0)
6558
// clang-format on
6659

6760
/**

0 commit comments

Comments
 (0)