[med-svn] [htslib] 01/06: Use internal plain char isdigit_c()/etc ctype functions

Andreas Tille tille at debian.org
Fri Nov 4 11:54:01 UTC 2016


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

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

commit 9919fca194fc8add94f47c9e728054c1949863f0
Author: John Marshall <jm18 at sanger.ac.uk>
Date:   Mon Apr 25 09:35:23 2016 +0100

    Use internal plain char isdigit_c()/etc ctype functions
    
    See fc9aeb6f77668afed412119701c5c58b0fca8091.
---
 hfile.c | 6 ++----
 hts.c   | 9 ++++-----
 sam.c   | 3 +--
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/hfile.c b/hfile.c
index e8b05fc..8580743 100644
--- a/hfile.c
+++ b/hfile.c
@@ -577,8 +577,6 @@ static hFILE *hopen_mem(const char *data, const char *mode)
  * Plugin and hopen() backend dispatcher *
  *****************************************/
 
-#include <ctype.h>
-
 #include "hts_internal.h"
 #include "htslib/khash.h"
 
@@ -717,8 +715,8 @@ static const struct hFILE_scheme_handler *find_scheme_handler(const char *s)
     int i;
 
     for (i = 0; i < sizeof scheme; i++)
-        if (isalnum(s[i]) || s[i] == '+' || s[i] == '-' || s[i] == '.')
-            scheme[i] = tolower(s[i]);
+        if (isalnum_c(s[i]) || s[i] == '+' || s[i] == '-' || s[i] == '.')
+            scheme[i] = tolower_c(s[i]);
         else if (s[i] == ':') break;
         else return NULL;
 
diff --git a/hts.c b/hts.c
index aaf92e2..dc28fce 100644
--- a/hts.c
+++ b/hts.c
@@ -26,7 +26,6 @@ DEALINGS IN THE SOFTWARE.  */
 #include <config.h>
 
 #include <zlib.h>
-#include <ctype.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -1848,24 +1847,24 @@ long long hts_parse_decimal(const char *str, char **strend, int flags)
     char sign = '+', esign = '+';
     const char *s;
 
-    while (isspace(*str)) str++;
+    while (isspace_c(*str)) str++;
     s = str;
 
     if (*s == '+' || *s == '-') sign = *s++;
     while (*s)
-        if (isdigit(*s)) n = push_digit(n, *s++);
+        if (isdigit_c(*s)) n = push_digit(n, *s++);
         else if (*s == ',' && (flags & HTS_PARSE_THOUSANDS_SEP)) s++;
         else break;
 
     if (*s == '.') {
         s++;
-        while (isdigit(*s)) decimals++, n = push_digit(n, *s++);
+        while (isdigit_c(*s)) decimals++, n = push_digit(n, *s++);
     }
 
     if (*s == 'E' || *s == 'e') {
         s++;
         if (*s == '+' || *s == '-') esign = *s++;
-        while (isdigit(*s)) e = push_digit(e, *s++);
+        while (isdigit_c(*s)) e = push_digit(e, *s++);
         if (esign == '-') e = -e;
     }
 
diff --git a/sam.c b/sam.c
index 66eeb2b..0196288 100644
--- a/sam.c
+++ b/sam.c
@@ -29,7 +29,6 @@ DEALINGS IN THE SOFTWARE.  */
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include <ctype.h>
 #include <zlib.h>
 #include "htslib/sam.h"
 #include "htslib/bgzf.h"
@@ -888,7 +887,7 @@ int sam_parse1(kstring_t *s, bam_hdr_t *h, bam1_t *b)
         uint32_t *cigar;
         size_t n_cigar = 0;
         for (q = p; *p && *p != '\t'; ++p)
-            if (!isdigit(*p)) ++n_cigar;
+            if (!isdigit_c(*p)) ++n_cigar;
         if (*p++ != '\t') goto err_ret;
         _parse_err(n_cigar == 0, "no CIGAR operations");
         _parse_err(n_cigar >= 65536, "too many CIGAR operations");

-- 
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