[med-svn] samtools 22/26: Moved khash_utils.h into htslib

Charles Plessy plessy at moszumanska.debian.org
Tue Dec 10 10:06:27 UTC 2013


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

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

commit d09cf942593a00a2fd58d0caa0ad46358639c5c5
Author: Petr Danecek <pd3 at sanger.ac.uk>
Date:   Fri Dec 6 09:40:13 2013 +0000

    Moved khash_utils.h into htslib
---
 khash_utils.h | 81 -----------------------------------------------------------
 stats.c       |  2 +-
 2 files changed, 1 insertion(+), 82 deletions(-)

diff --git a/khash_utils.h b/khash_utils.h
deleted file mode 100644
index e277658..0000000
--- a/khash_utils.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef __KHASH_UTILS_H__
-#define __KHASH_UTILS_H__
-
-#include <htslib/khash.h>
-
-KHASH_MAP_INIT_STR(str2int, int)
-
-/*
- *  Wrappers for khash dictionaries used by mpileup. 
- */
-
-static inline void *khash_str2int_init()
-{
-    return kh_init(str2int);
-}
-
-/*
- *  Destroy the hash structure, but not the keys
- */ 
-static inline void khash_str2int_destroy(void *_hash)
-{
-    khash_t(str2int) *hash = (khash_t(str2int)*)_hash;
-    if (hash) kh_destroy(str2int, hash); // Note that strings are not freed.
-}
-
-/*
- *  Destroys both the hash structure and the keys
- */ 
-static inline void khash_str2int_destroy_free(void *_hash)
-{
-    khash_t(str2int) *hash = (khash_t(str2int)*)_hash;
-    khint_t k;
-    if (hash == 0) return;
-    for (k = 0; k < kh_end(hash); ++k)
-        if (kh_exist(hash, k)) free((char*)kh_key(hash, k));
-    kh_destroy(str2int, hash);
-}
-
-/*
- *  Returns 1 if key exists or 0 if not
- */
-static inline int khash_str2int_has_key(void *_hash, const char *str)
-{
-    khash_t(str2int) *hash = (khash_t(str2int)*)_hash;
-    khint_t k = kh_get(str2int, hash, str);
-    if ( k == kh_end(hash) ) return 0;
-    return 1;
-}
-
-/*
- *  Returns 0 on success and -1 when the key is not present. On success,
- *  *value is set, unless NULL is passed.
- */
-static inline int khash_str2int_get(void *_hash, const char *str, int *value)
-{
-    khash_t(str2int) *hash = (khash_t(str2int)*)_hash;
-    khint_t k;
-    if ( !hash ) return -1;
-    k = kh_get(str2int, hash, str);
-    if ( k == kh_end(hash) ) return -1;
-    if ( !*value ) return 0;
-    *value = kh_val(hash, k);
-    return 0;
-}
-
-/*
- *  Add a new string to the dictionary, auto-incrementing the value.
- */
-static inline int khash_str2int_inc(void *_hash, const char *str)
-{
-    khint_t k;
-    int ret;
-    khash_t(str2int) *hash = (khash_t(str2int)*)_hash;
-    if ( !hash ) return -1;
-    k = kh_put(str2int, hash, str, &ret);
-    if (ret == 0) return kh_val(hash, k);
-    kh_val(hash, k) = kh_size(hash) - 1;
-    return kh_val(hash, k);
-}
-
-#endif
diff --git a/stats.c b/stats.c
index 45864d9..3c1e78e 100644
--- a/stats.c
+++ b/stats.c
@@ -27,7 +27,7 @@
 #include <htslib/faidx.h>
 #include "sam.h"            // have to keep local version because of sam header parsing. todo: migrate to htslib
 #include "sam_header.h"     //
-#include "khash_utils.h"
+#include <htslib/khash_str2int.h>
 #include "samtools.h"
 
 #define BWA_MIN_RDLEN 35

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



More information about the debian-med-commit mailing list