Skip to content

Commit

Permalink
Use isspace_c() et al in annot-tsv.c
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarshall committed Jul 16, 2024
1 parent 96af274 commit 7b042d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ htsfile: htsfile.o libhts.a
tabix: tabix.o libhts.a
$(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) -lpthread

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)
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)
bgzip.o: bgzip.c config.h $(htslib_bgzf_h) $(htslib_hts_h) $(htslib_hfile_h)
htsfile.o: htsfile.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h)
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)
Expand Down
7 changes: 4 additions & 3 deletions annot-tsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "htslib/kseq.h"
#include "htslib/bgzf.h"
#include "htslib/regidx.h"
#include "textutils_internal.h"

#define ANN_NBP 1
#define ANN_FRAC 2
Expand Down Expand Up @@ -409,15 +410,15 @@ void parse_header(dat_t *dat, char *fname, int nth_row, int autodetect)
for (i=0; i<cols->n; i++)
{
char *ss = cols->off[i];
while ( *ss && (*ss=='#' || isspace(*ss)) ) ss++;
while ( *ss && (*ss=='#' || isspace_c(*ss)) ) ss++;
if ( !*ss ) error("Could not parse the header field \"%s\": %s\n", cols->off[i],dat->line.s);
if ( *ss=='[' )
{
char *se = ss+1;
while ( *se && isdigit(*se) ) se++;
while ( *se && isdigit_c(*se) ) se++;
if ( *se==']' ) ss = se + 1;
}
while ( *ss && (*ss=='#' || isspace(*ss)) ) ss++;
while ( *ss && (*ss=='#' || isspace_c(*ss)) ) ss++;
if ( !*ss ) error("Could not parse the header field \"%s\": %s\n", cols->off[i],dat->line.s);
cols->off[i] = ss;
khash_str2int_set(dat->hdr.name2idx, cols->off[i], i);
Expand Down

0 comments on commit 7b042d3

Please sign in to comment.