Skip to content

Commit db2b449

Browse files
authored
Miscellaneous minor build infrastructure and code fixes (PR #1807)
* Ignore and clean test/*/FAIL* for six subdirectories These files can appear in base_mods, fastq, mpileup, and sam_filter as well as faidx and tabix. * Fix comment header to use `@CO\t` as per other comment headers * Remove extraneous inclusion and add missing dependency * Remove last traces of previously deleted bgzf_idx_amend_last() As noted in #1722, this function was removed in PR #1672. * Use isspace_c() et al in annot-tsv.c * Minor corrections to system headers Plain getopt() is declared in <unistd.h>; strcasecmp() et al are only portably declared in <strings.h>.
1 parent 19a27e9 commit db2b449

File tree

9 files changed

+14
-25
lines changed

9 files changed

+14
-25
lines changed

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ shlib-exports-*.txt
4545
/bgzip
4646
/htsfile
4747
/tabix
48+
/test/*/FAIL*
4849
/test/bgzf_boundaries/*.tmp.*
4950
/test/faidx/*.tmp*
50-
/test/faidx/FAIL*
5151
/test/fieldarith
5252
/test/hfile
5353
/test/hts_endian
@@ -57,7 +57,6 @@ shlib-exports-*.txt
5757
/test/plugins-dlhts
5858
/test/sam
5959
/test/tabix/*.tmp.*
60-
/test/tabix/FAIL*
6160
/test/test-bcf-sr
6261
/test/test-bcf-translate
6362
/test/test-bcf_set_variant_type

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,10 @@ htsfile: htsfile.o libhts.a
526526
tabix: tabix.o libhts.a
527527
$(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) -lpthread
528528

529-
annot-tsv.o: annot-tsv.c config.h $(htslib_hts_h) $(htslib_hts_defs_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_kseq_h) $(htslib_bgzf_h) $(htslib_regidx_h)
529+
annot-tsv.o: annot-tsv.c config.h $(htslib_hts_h) $(htslib_hts_defs_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_kseq_h) $(htslib_bgzf_h) $(htslib_regidx_h) $(textutils_internal_h)
530530
bgzip.o: bgzip.c config.h $(htslib_bgzf_h) $(htslib_hts_h) $(htslib_hfile_h)
531531
htsfile.o: htsfile.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h)
532-
tabix.o: tabix.c config.h $(htslib_tbx_h) $(htslib_sam_h) $(htslib_vcf_h) $(htslib_kseq_h) $(htslib_bgzf_h) $(htslib_hts_h) $(htslib_regidx_h) $(htslib_hts_defs_h) $(htslib_hts_log_h)
532+
tabix.o: tabix.c config.h $(htslib_tbx_h) $(htslib_sam_h) $(htslib_vcf_h) $(htslib_kseq_h) $(htslib_bgzf_h) $(htslib_hts_h) $(htslib_regidx_h) $(htslib_hts_defs_h) $(htslib_hts_log_h) $(htslib_thread_pool_h)
533533

534534
# Runes to check that the htscodecs submodule is present
535535
ifdef HTSCODECS_SOURCES
@@ -924,9 +924,9 @@ htslib-uninstalled.pc: htslib.pc.tmp
924924

925925

926926
testclean:
927-
-rm -f test/*.tmp test/*.tmp.* test/faidx/*.tmp* test/faidx/FAIL* \
928-
test/longrefs/*.tmp.* test/tabix/*.tmp.* test/tabix/FAIL* \
929-
test/bgzf_boundaries/*.tmp.* \
927+
-rm -f test/*.tmp test/*.tmp.* test/faidx/*.tmp* \
928+
test/longrefs/*.tmp.* test/tabix/*.tmp.* \
929+
test/bgzf_boundaries/*.tmp.* test/*/FAIL* \
930930
header-exports.txt shlib-exports-$(SHLIB_FLAVOUR).txt
931931
-rm -rf htscodecs/tests/test.out
932932

annot-tsv.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "htslib/kseq.h"
4545
#include "htslib/bgzf.h"
4646
#include "htslib/regidx.h"
47+
#include "textutils_internal.h"
4748

4849
#define ANN_NBP 1
4950
#define ANN_FRAC 2
@@ -409,15 +410,15 @@ void parse_header(dat_t *dat, char *fname, int nth_row, int autodetect)
409410
for (i=0; i<cols->n; i++)
410411
{
411412
char *ss = cols->off[i];
412-
while ( *ss && (*ss=='#' || isspace(*ss)) ) ss++;
413+
while ( *ss && (*ss=='#' || isspace_c(*ss)) ) ss++;
413414
if ( !*ss ) error("Could not parse the header field \"%s\": %s\n", cols->off[i],dat->line.s);
414415
if ( *ss=='[' )
415416
{
416417
char *se = ss+1;
417-
while ( *se && isdigit(*se) ) se++;
418+
while ( *se && isdigit_c(*se) ) se++;
418419
if ( *se==']' ) ss = se + 1;
419420
}
420-
while ( *ss && (*ss=='#' || isspace(*ss)) ) ss++;
421+
while ( *ss && (*ss=='#' || isspace_c(*ss)) ) ss++;
421422
if ( !*ss ) error("Could not parse the header field \"%s\": %s\n", cols->off[i],dat->line.s);
422423
cols->off[i] = ss;
423424
khash_str2int_set(dat->hdr.name2idx, cols->off[i], i);

cram/cram_external.c

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4949
#endif
5050

5151
#include "../htslib/hfile.h"
52-
#include "../hfile_internal.h"
5352
#include "cram.h"
5453

5554
/*

hts_internal.h

-12
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,6 @@ const char *hts_plugin_path(void);
123123
*/
124124
int bgzf_idx_push(BGZF *fp, hts_idx_t *hidx, int tid, hts_pos_t beg, hts_pos_t end, uint64_t offset, int is_mapped);
125125

126-
/*
127-
* bgzf analogue to hts_idx_amend_last.
128-
*
129-
* This is needed when multi-threading and writing indices on the fly.
130-
* At the point of writing a record we know the virtual offset for start
131-
* and end, but that end virtual offset may be the end of the current
132-
* block. In standard indexing our end virtual offset becomes the start
133-
* of the next block. Thus to ensure bit for bit compatibility we
134-
* detect this boundary case and fix it up here.
135-
*/
136-
void bgzf_idx_amend_last(BGZF *fp, hts_idx_t *hidx, uint64_t offset);
137-
138126
static inline int find_file_extension(const char *fn, char ext_out[static HTS_MAX_EXT_LEN])
139127
{
140128
const char *delim = fn ? strstr(fn, HTS_IDX_DELIM) : NULL, *ext;

samples/mod_aux.c

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ DEALINGS IN THE SOFTWARE
2727
/* The pupose of this code is to demonstrate the library apis and need proper error handling and optimization */
2828

2929
#include <getopt.h>
30+
#include <strings.h>
3031
#include <unistd.h>
3132
#include <htslib/sam.h>
3233

samples/mod_bam.c

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ DEALINGS IN THE SOFTWARE
2727
/* The pupose of this code is to demonstrate the library apis and need proper error handling and optimization */
2828

2929
#include <getopt.h>
30+
#include <strings.h>
3031
#include <unistd.h>
3132
#include <htslib/sam.h>
3233

test/base_mods/MM-explicit.sam

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
@CO ATCATCATTCCTACCGCTATAGCCT r3; mixture
2020
@CO - - . -. - --
2121
@CO M M
22-
@CO - - ?? ?? ? --
22+
@CO - - ?? ?? ? --
2323
@CO hH hh h --
2424
@CO
2525
r1 0 * 0 0 * * 0 0 ATCATCATTCCTACCGCTATAGCCT * Mm:Z:C+mh,2,0,1; Ml:B:C,200,10,50,170,160,20

test/test_faidx.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ DEALINGS IN THE SOFTWARE. */
2626

2727
#include <stdio.h>
2828
#include <stdlib.h>
29-
#include <getopt.h>
29+
#include <unistd.h>
3030

3131
#include "../htslib/faidx.h"
3232

0 commit comments

Comments
 (0)