[med-svn] [htslib] 02/10: Clean after regidx init failure; fixed build dependencies

Charles Plessy plessy at moszumanska.debian.org
Sun Oct 5 00:54:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch debian/unstable
in repository htslib.

commit f4b4b61757f6268dfa6ed100fc2ea650c350bbd2
Author: Petr Danecek <pd3 at sanger.ac.uk>
Date:   Wed Oct 1 08:55:06 2014 +0100

    Clean after regidx init failure; fixed build dependencies
---
 Makefile       | 2 +-
 htslib.mk      | 1 +
 htslib_vars.mk | 2 +-
 regidx.c       | 7 ++++---
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index cbc5360..5f8d778 100644
--- a/Makefile
+++ b/Makefile
@@ -206,7 +206,7 @@ synced_bcf_reader.o synced_bcf_reader.pico: synced_bcf_reader.c $(htslib_synced_
 vcf_sweep.o vcf_sweep.pico: vcf_sweep.c $(htslib_vcf_sweep_h) $(htslib_bgzf_h)
 vcfutils.o vcfutils.pico: vcfutils.c $(htslib_vcfutils_h)
 kfunc.o kfunc.pico: kfunc.c htslib/kfunc.h
-regidx.o regidx.pico: regidx.c $(htslib_regidx_h)
+regidx.o regidx.pico: regidx.c $(htslib_regidx_h) $(HTSPREFIX)htslib/kstring.h $(HTSPREFIX)htslib/kseq.h  $(HTSPREFIX)htslib/khash_str2int.h
 
 cram/cram_codecs.o cram/cram_codecs.pico: cram/cram_codecs.c $(cram_h)
 cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c $(cram_h) cram/os.h cram/md5.h
diff --git a/htslib.mk b/htslib.mk
index 6c203ca..7e7437b 100644
--- a/htslib.mk
+++ b/htslib.mk
@@ -77,6 +77,7 @@ HTSLIB_ALL = \
 	$(HTSDIR)/hts.c \
 	$(HTSDIR)/knetfile.c \
 	$(HTSDIR)/kstring.c \
+	$(HTSDIR)/regidx.c \
 	$(HTSDIR)/sam.c \
 	$(HTSDIR)/synced_bcf_reader.c \
 	$(HTSDIR)/tbx.c \
diff --git a/htslib_vars.mk b/htslib_vars.mk
index 5a0fcbc..8203d84 100644
--- a/htslib_vars.mk
+++ b/htslib_vars.mk
@@ -36,4 +36,4 @@ htslib_tbx_h = $(HTSPREFIX)htslib/tbx.h $(htslib_hts_h)
 htslib_vcf_h = $(HTSPREFIX)htslib/vcf.h $(htslib_hts_h) $(HTSPREFIX)htslib/kstring.h
 htslib_vcf_sweep_h = $(HTSPREFIX)htslib/vcf_sweep.h $(htslib_hts_h) $(htslib_vcf_h)
 htslib_vcfutils_h = $(HTSPREFIX)htslib/vcfutils.h $(htslib_vcf_h)
-htslib_regidx_h = $(HTSPREFIX)htslib/regidx.h $(HTSPREFIX)htslib/kstring.h $(HTSPREFIX)htslib/kseq.h  $(HTSPREFIX)htslib/khash_str2int.h
+htslib_regidx_h = $(HTSPREFIX)htslib/regidx.h
diff --git a/regidx.c b/regidx.c
index 9318ee1..5dd3b0e 100644
--- a/regidx.c
+++ b/regidx.c
@@ -163,10 +163,11 @@ regidx_t *regidx_init(const char *fname, regidx_parse_f parser, regidx_free_f fr
 
     if ( !fname ) return idx;
     
+    kstring_t str = {0,0,0};
+
     htsFile *fp = hts_open(fname,"r");
-    if ( !fp ) return NULL;
+    if ( !fp ) goto error;
 
-    kstring_t str = {0,0,0};
     while ( hts_getline(fp, KS_SEP_LINE, &str) > 0 )
     {
         if ( regidx_insert(idx, str.s) ) goto error;
@@ -179,7 +180,7 @@ regidx_t *regidx_init(const char *fname, regidx_parse_f parser, regidx_free_f fr
 
 error:
     free(str.s);
-    hts_close(fp);
+    if ( fp ) hts_close(fp);
     regidx_destroy(idx);
     return NULL;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/htslib.git



More information about the debian-med-commit mailing list