Skip to content

Commit 8036764

Browse files
committed
Add apply_verbosity() function to implement --verbosity
Clang considers declaring a variable after a case label to be an error. Introduce a function encapsulating --verbosity parsing to avoid needing a local variable within this option parsing case. Similarly in vcfmerge.c, avoid declaring a variable after a goto label.
1 parent 283023b commit 8036764

35 files changed

+48
-107
lines changed

bcftools.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ void error(const char *format, ...) HTS_NORETURN HTS_FORMAT(HTS_PRINTF_FMT, 1, 2
5050
// newline will be added by the function.
5151
void error_errno(const char *format, ...) HTS_NORETURN HTS_FORMAT(HTS_PRINTF_FMT, 1, 2);
5252

53+
// Set hts_verbose and return 0, or return -1 if str is not a valid integer
54+
int apply_verbosity(const char *str);
55+
5356
// For on the fly index creation with --write-index
5457
int init_index2(htsFile *fh, bcf_hdr_t *hdr, const char *fname, char **idx_fname, int idx_fmt);
5558
int init_index(htsFile *fh, bcf_hdr_t *hdr, const char *fname, char **idx_fname);

consensus.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,15 +1259,12 @@ int main_consensus(int argc, char *argv[])
12591259
{0,0,0,0}
12601260
};
12611261
int c;
1262-
char *tmp;
12631262
while ((c = getopt_long(argc, argv, "h?s:S:1Ii:e:H:f:o:m:c:M:p:a:v:",loptions,NULL)) >= 0)
12641263
{
12651264
switch (c)
12661265
{
12671266
case 'v':
1268-
int verbose = strtol(optarg,&tmp,10);
1269-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
1270-
if ( verbose > 3 ) hts_verbose = verbose;
1267+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
12711268
break;
12721269
case 1 : args->mark_del = optarg[0]; break;
12731270
case 2 :

mpileup.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,13 +1469,10 @@ int main_mpileup(int argc, char *argv[])
14691469
{"verbosity",required_argument,NULL,'v'},
14701470
{NULL, 0, NULL, 0}
14711471
};
1472-
char *tmp;
14731472
while ((c = getopt_long(argc, argv, "Ag:f:r:R:q:Q:C:BDd:L:b:P:po:e:h:Im:F:EG:6O:xa:s:S:t:T:M:X:UW::v:",lopts,NULL)) >= 0) {
14741473
switch (c) {
14751474
case 'v':
1476-
int verbose = strtol(optarg,&tmp,10);
1477-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
1478-
if ( verbose > 3 ) hts_verbose = verbose;
1475+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
14791476
break;
14801477
case 'x': mplp.flag &= ~MPLP_SMART_OVERLAPS; break;
14811478
case 16 :

plugins/check-sparsity.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ int run(int argc, char **argv)
246246
switch (c)
247247
{
248248
case 'v':
249-
int verbose = strtol(optarg,&tmp,10);
250-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
251-
if ( verbose > 3 ) hts_verbose = verbose;
249+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
252250
break;
253251
case 'n':
254252
args->min_sites = strtol(optarg,&tmp,10);

plugins/contrast.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,7 @@ int run(int argc, char **argv)
499499
switch (c)
500500
{
501501
case 'v':
502-
int verbose = strtol(optarg,&tmp,10);
503-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
504-
if ( verbose > 3 ) hts_verbose = verbose;
502+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
505503
break;
506504
case 1 : args->force_samples = 1; break;
507505
case 'f': args->max_AC_str = optarg; break;

plugins/gvcfz.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,7 @@ int run(int argc, char **argv)
347347
switch (c)
348348
{
349349
case 'v':
350-
int verbose = strtol(optarg,&tmp,10);
351-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
352-
if ( verbose > 3 ) hts_verbose = verbose;
350+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
353351
break;
354352
case 'a': args->trim_alts = 1; break;
355353
case 'e':

plugins/indel-stats.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,7 @@ int run(int argc, char **argv)
706706
switch (c)
707707
{
708708
case 'v':
709-
int verbose = strtol(optarg,&tmp,10);
710-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
711-
if ( verbose > 3 ) hts_verbose = verbose;
709+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
712710
break;
713711
case 1 :
714712
MAX_LEN = strtod(optarg,&tmp);

plugins/isecGT.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ int run(int argc, char **argv)
9999
switch (c)
100100
{
101101
case 'v':
102-
int verbose = strtol(optarg,&tmp,10);
103-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
104-
if ( verbose > 3 ) hts_verbose = verbose;
102+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
105103
break;
106104
case 'o': args->output_fname = optarg; break;
107105
case 'O':

plugins/mendelian2.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,7 @@ int run(int argc, char **argv)
832832
switch (c)
833833
{
834834
case 'v':
835-
int verbose = strtol(optarg,&tmp,10);
836-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
837-
if ( verbose > 3 ) hts_verbose = verbose;
835+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
838836
break;
839837
case 'e':
840838
if ( args->filter_str ) error("Error: only one -i or -e expression can be given, and they cannot be combined\n");

plugins/parental-origin.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,7 @@ int run(int argc, char **argv)
345345
switch (c)
346346
{
347347
case 'v':
348-
int verbose = strtol(optarg,&tmp,10);
349-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
350-
if ( verbose > 3 ) hts_verbose = verbose;
348+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
351349
break;
352350
case 'e':
353351
if ( args->filter_str ) error("Error: only one -i or -e expression can be given, and they cannot be combined\n");

plugins/prune.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,7 @@ int run(int argc, char **argv)
363363
switch (c)
364364
{
365365
case 'v':
366-
int verbose = strtol(optarg,&tmp,10);
367-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
368-
if ( verbose > 3 ) hts_verbose = verbose;
366+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
369367
break;
370368
case 1 : args->rand_missing = 1; break;
371369
case 2 : args->af_tag = optarg; break;

plugins/remove-overlaps.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,7 @@ int run(int argc, char **argv)
244244
switch (c)
245245
{
246246
case 'v':
247-
int verbose = strtol(optarg,&tmp,10);
248-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
249-
if ( verbose > 3 ) hts_verbose = verbose;
247+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
250248
break;
251249
case 'm': args->mark_expr = optarg; break;
252250
case 'M': args->mark_tag = optarg; break;

plugins/scatter.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,7 @@ int run(int argc, char **argv)
372372
switch (c)
373373
{
374374
case 'v':
375-
int verbose = strtol(optarg,&tmp,10);
376-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
377-
if ( verbose > 3 ) hts_verbose = verbose;
375+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
378376
break;
379377
case 'e':
380378
if ( args->filter_str ) error("Error: only one -i or -e expression can be given, and they cannot be combined\n");

plugins/smpl-stats.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,12 @@ int run(int argc, char **argv)
446446
{NULL,0,NULL,0}
447447
};
448448
int c, i;
449-
char *tmp;
450449
while ((c = getopt_long(argc, argv, "o:s:i:e:r:R:t:T:v:",loptions,NULL)) >= 0)
451450
{
452451
switch (c)
453452
{
454453
case 'v':
455-
int verbose = strtol(optarg,&tmp,10);
456-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
457-
if ( verbose > 3 ) hts_verbose = verbose;
454+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
458455
break;
459456
case 'e':
460457
if ( args->filter_str ) error("Error: only one -i or -e expression can be given, and they cannot be combined\n");

plugins/split-vep.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,9 +1588,7 @@ int run(int argc, char **argv)
15881588
switch (c)
15891589
{
15901590
case 'v':
1591-
int verbose = strtol(optarg,&tmp,10);
1592-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
1593-
if ( verbose > 3 ) hts_verbose = verbose;
1591+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
15941592
break;
15951593
case 2 : args->record_cmd_line = 0; break;
15961594
case 1 : args->column_types = optarg; break;

plugins/split.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,7 @@ int run(int argc, char **argv)
668668
switch (c)
669669
{
670670
case 'v':
671-
int verbose = strtol(optarg,&tmp,10);
672-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
673-
if ( verbose > 3 ) hts_verbose = verbose;
671+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
674672
break;
675673
case 1 : args->hts_opts = hts_readlist(optarg,0,&args->nhts_opts); break;
676674
case 'k': args->keep_tags = optarg; break;

plugins/trio-dnm2.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,9 +1685,7 @@ int run(int argc, char **argv)
16851685
switch (c)
16861686
{
16871687
case 'v':
1688-
int verbose = strtol(optarg,&tmp,10);
1689-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
1690-
if ( verbose > 3 ) hts_verbose = verbose;
1688+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
16911689
break;
16921690
case 1 : args->force_ad = 1; break;
16931691
case 2 : free(args->dnm_score_tag); args->dnm_score_tag = strdup(optarg); break;

plugins/trio-stats.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -728,15 +728,12 @@ int run(int argc, char **argv)
728728
{NULL,0,NULL,0}
729729
};
730730
int c, i;
731-
char *tmp;
732731
while ((c = getopt_long(argc, argv, "P:p:o:s:i:e:r:R:t:T:a:d:v:",loptions,NULL)) >= 0)
733732
{
734733
switch (c)
735734
{
736735
case 'v':
737-
int verbose = strtol(optarg,&tmp,10);
738-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
739-
if ( verbose > 3 ) hts_verbose = verbose;
736+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
740737
break;
741738
case 'd':
742739
{

plugins/variant-distance.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,7 @@ int run(int argc, char **argv)
260260
switch (c)
261261
{
262262
case 'v':
263-
int verbose = strtol(optarg,&tmp,10);
264-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
265-
if ( verbose > 3 ) hts_verbose = verbose;
263+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
266264
break;
267265
case 'd':
268266
if ( !strcasecmp("nearest",optarg) ) args->direction = DIR_NEAREST;

reheader.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -699,15 +699,12 @@ int main_reheader(int argc, char *argv[])
699699
{"verbosity",required_argument,NULL,'v'},
700700
{0,0,0,0}
701701
};
702-
char *tmp;
703702
while ((c = getopt_long(argc, argv, "s:h:o:f:T:v:",loptions,NULL)) >= 0)
704703
{
705704
switch (c)
706705
{
707706
case 'v':
708-
int verbose = strtol(optarg,&tmp,10);
709-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
710-
if ( verbose > 3 ) hts_verbose = verbose;
707+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
711708
break;
712709
case 1 : args->n_threads = strtol(optarg, 0, 0); break;
713710
case 'T': break; // unused - was temp file prefix

vcfannotate.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3739,9 +3739,7 @@ int main_vcfannotate(int argc, char *argv[])
37393739
{
37403740
switch (c) {
37413741
case 'v':
3742-
int verbose = strtol(optarg,&tmp,10);
3743-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
3744-
if ( verbose > 3 ) hts_verbose = verbose;
3742+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
37453743
break;
37463744
case 'f': args->force = 1; break;
37473745
case 'k': args->keep_sites = 1; break;

vcfcall.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,9 +1154,7 @@ int main_vcfcall(int argc, char *argv[])
11541154
error("Unsupported index format '%s'\n", optarg);
11551155
break;
11561156
case 10:
1157-
int verbose = strtol(optarg,&tmp,10);
1158-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
1159-
if ( verbose > 3 ) hts_verbose = verbose;
1157+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
11601158
break;
11611159
default: usage(&args);
11621160
}

vcfcnv.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,9 +1303,7 @@ int main_vcfcnv(int argc, char *argv[])
13031303
while ((c = getopt_long(argc, argv, "h?r:R:t:T:s:o:p:l:T:c:b:P:x:e:O:W::f:a:L:d:k:v:",loptions,NULL)) >= 0) {
13041304
switch (c) {
13051305
case 'v':
1306-
int verbose = strtol(optarg,&tmp,10);
1307-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
1308-
if ( verbose > 3 ) hts_verbose = verbose;
1306+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
13091307
break;
13101308
case 'L':
13111309
args->lrr_smooth_win = strtol(optarg,&tmp,10);

vcfconvert.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,9 +1729,7 @@ int main_vcfconvert(int argc, char *argv[])
17291729
while ((c = getopt_long(argc, argv, "?h:r:R:s:S:t:T:i:e:g:G:o:O:c:f:H:W::v:",loptions,NULL)) >= 0) {
17301730
switch (c) {
17311731
case 'v':
1732-
int verbose = strtol(optarg,&tmp,10);
1733-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
1734-
if ( verbose > 3 ) hts_verbose = verbose;
1732+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
17351733
break;
17361734
case 'e':
17371735
if ( args->filter_str ) error("Error: only one -i or -e expression can be given, and they cannot be combined\n");

vcffilter.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,7 @@ int main_vcffilter(int argc, char *argv[])
545545
while ((c = getopt_long(argc, argv, "e:i:t:T:r:R:h?s:m:M:o:O:g:G:S:W::v:",loptions,NULL)) >= 0) {
546546
switch (c) {
547547
case 'v':
548-
int verbose = strtol(optarg,&tmp,10);
549-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
550-
if ( verbose > 3 ) hts_verbose = verbose;
548+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
551549
break;
552550
case 'g':
553551
args->snp_gap = strtol(optarg,&tmp,10);

vcfgtcheck.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,9 +1255,7 @@ int main_vcfgtcheck(int argc, char *argv[])
12551255
while ((c = getopt_long(argc, argv, "hg:p:s:S:p:P:Hr:R:at:T:G:c:u:e:E:i:o:O:v:",loptions,NULL)) >= 0) {
12561256
switch (c) {
12571257
case 'v':
1258-
int verbose = strtol(optarg,&tmp,10);
1259-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
1260-
if ( verbose > 3 ) hts_verbose = verbose;
1258+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
12611259
break;
12621260
case 'o': args->output_fname = optarg; break;
12631261
case 'O':

vcfhead.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,11 @@ int main_vcfhead(int argc, char *argv[])
6161
uint64_t nheaders = 0;
6262
uint64_t nrecords = 0;
6363

64-
char *tmp;
6564
int c, nargs;
6665
while ((c = getopt_long(argc, argv, "h:n:s:v:", loptions, NULL)) >= 0)
6766
switch (c) {
6867
case 'v':
69-
int verbose = strtol(optarg,&tmp,10);
70-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
71-
if ( verbose > 3 ) hts_verbose = verbose;
68+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
7269
break;
7370
case 'h': all_headers = 0; nheaders = strtoull(optarg, NULL, 0); break;
7471
case 'n': nrecords = strtoull(optarg, NULL, 0); break;

vcfindex.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@ int main_vcfindex(int argc, char *argv[])
249249
switch (c)
250250
{
251251
case 'v':
252-
int verbose = strtol(optarg,&tmp,10);
253-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
254-
if ( verbose > 3 ) hts_verbose = verbose;
252+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
255253
break;
256254
case 'c': tbi = 0; break;
257255
case 't': tbi = 1; min_shift = 0; break;

vcfisec.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,7 @@ int main_vcfisec(int argc, char *argv[])
573573
while ((c = getopt_long(argc, argv, "hc:r:R:p:n:w:t:T:Cf:o:O:i:e:l:W::v:",loptions,NULL)) >= 0) {
574574
switch (c) {
575575
case 'v':
576-
int verbose = strtol(optarg,&tmp,10);
577-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
578-
if ( verbose > 3 ) hts_verbose = verbose;
576+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
579577
break;
580578
case 'o': args->output_fname = optarg; break;
581579
case 'O':

vcfmerge.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,6 +2725,8 @@ void gvcf_flush(args_t *args, int done)
27252725

27262726
static inline int is_gvcf_block(args_t *args, bcf1_t *line)
27272727
{
2728+
maux_t *ma;
2729+
27282730
if ( line->rlen<=1 ) return 0;
27292731
if ( strlen(line->d.allele[0])==line->rlen ) return 0;
27302732
if ( line->n_allele==1 ) goto is_gvcf;
@@ -2739,7 +2741,7 @@ static inline int is_gvcf_block(args_t *args, bcf1_t *line)
27392741
return 0;
27402742

27412743
is_gvcf:
2742-
maux_t *ma = args->maux;
2744+
ma = args->maux;
27432745
if ( !ma->gvcf )
27442746
{
27452747
args->do_gvcf = 1;
@@ -3607,9 +3609,7 @@ int main_vcfmerge(int argc, char *argv[])
36073609
while ((c = getopt_long(argc, argv, "hm:f:r:R:o:O:i:M:l:g:F:0L:W::v:",loptions,NULL)) >= 0) {
36083610
switch (c) {
36093611
case 'v':
3610-
int verbose = strtol(optarg,&tmp,10);
3611-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
3612-
if ( verbose > 3 ) hts_verbose = verbose;
3612+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
36133613
break;
36143614
case 'L':
36153615
args->local_alleles = strtol(optarg,&tmp,10);

vcfquery.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ int main_vcfquery(int argc, char *argv[])
301301
{"verbosity",required_argument,NULL,4},
302302
{0,0,0,0}
303303
};
304-
char *tmp;
305304
while ((c = getopt_long(argc, argv, "hlr:R:F:f:a:s:S:Ht:T:c:v:i:e:o:uN",loptions,NULL)) >= 0) {
306305
switch (c) {
307306
case 'o': args->fn_out = optarg; break;
@@ -354,9 +353,7 @@ int main_vcfquery(int argc, char *argv[])
354353
break;
355354
case 3 : args->force_samples = 1; break;
356355
case 4 :
357-
int verbose = strtol(optarg,&tmp,10);
358-
if ( *tmp || verbose<0 ) error("Could not parse argument: --verbosity %s\n", optarg);
359-
if ( verbose > 3 ) hts_verbose = verbose;
356+
if ( apply_verbosity(optarg) < 0 ) error("Could not parse argument: --verbosity %s\n", optarg);
360357
break;
361358
case 'h':
362359
case '?': usage(); break;

0 commit comments

Comments
 (0)