diff options
author | Guillem Jover <guillem@debian.org> | 2014-12-28 20:14:48 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2015-01-28 20:50:29 +0100 |
commit | 45dcca46d83ea52d683afa4b486d9321148b46cf (patch) | |
tree | 538fde63d7ca9510562c15c4f52802da717947b0 /src | |
parent | 8183122e10463954453d756f4a037f9ea3f1c5c5 (diff) | |
download | dpkg-45dcca46d83ea52d683afa4b486d9321148b46cf.tar.gz |
Switch code to use the new C locale character type functions
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 12 | ||||
-rw-r--r-- | src/remove.c | 5 | ||||
-rw-r--r-- | src/select.c | 16 | ||||
-rw-r--r-- | src/unpack.c | 4 |
4 files changed, 23 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c index 4b3137c11..58f099759 100644 --- a/src/main.c +++ b/src/main.c @@ -32,7 +32,6 @@ #if HAVE_LOCALE_H #include <locale.h> #endif -#include <ctype.h> #include <string.h> #include <fcntl.h> #include <dirent.h> @@ -43,6 +42,7 @@ #include <dpkg/macros.h> #include <dpkg/i18n.h> +#include <dpkg/c-ctype.h> #include <dpkg/dpkg.h> #include <dpkg/dpkg-db.h> #include <dpkg/arch.h> @@ -793,7 +793,11 @@ commandfd(const char *const *argv) push_error_context(); - do { c= getc(in); if (c == '\n') lno++; } while (c != EOF && isspace(c)); + do { + c = getc(in); + if (c == '\n') + lno++; + } while (c != EOF && c_isspace(c)); if (c == EOF) break; if (c == '#') { do { c= getc(in); if (c == '\n') lno++; } while (c != EOF && c != '\n'); @@ -806,7 +810,7 @@ commandfd(const char *const *argv) if (c == '\n') lno++; /* This isn't fully accurate, but overestimating can't hurt. */ - if (isspace(c)) + if (c_isspace(c)) argc++; } while (c != EOF && c != '\n'); if (c == EOF) ohshit(_("unexpected eof before end of line %d"),lno); @@ -825,7 +829,7 @@ commandfd(const char *const *argv) endptr--; skipchar = true; continue; - } else if (isspace(*ptr)) { + } else if (c_isspace(*ptr)) { if (mode == true) { *ptr = '\0'; mode = false; diff --git a/src/remove.c b/src/remove.c index a76dd6c90..61b908a71 100644 --- a/src/remove.c +++ b/src/remove.c @@ -26,7 +26,6 @@ #include <sys/stat.h> #include <errno.h> -#include <ctype.h> #include <string.h> #include <fcntl.h> #include <dirent.h> @@ -35,6 +34,7 @@ #include <stdio.h> #include <dpkg/i18n.h> +#include <dpkg/c-ctype.h> #include <dpkg/dpkg.h> #include <dpkg/dpkg-db.h> #include <dpkg/pkg.h> @@ -558,7 +558,8 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { goto yes_remove; p= de->d_name+conffbasenamelen; if (*p++ == '~') { - while (*p && cisdigit(*p)) p++; + while (*p && c_isdigit(*p)) + p++; if (*p == '~' && !*++p) goto yes_remove; } } diff --git a/src/select.c b/src/select.c index cdfd5bdd4..a1eeb5292 100644 --- a/src/select.c +++ b/src/select.c @@ -25,12 +25,12 @@ #include <compat.h> #include <fnmatch.h> -#include <ctype.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <dpkg/i18n.h> +#include <dpkg/c-ctype.h> #include <dpkg/dpkg.h> #include <dpkg/dpkg-db.h> #include <dpkg/pkg-array.h> @@ -133,7 +133,11 @@ setselections(const char *const *argv) for (;;) { struct dpkg_error err; - do { c= getchar(); if (c == '\n') lno++; } while (c != EOF && isspace(c)); + do { + c = getchar(); + if (c == '\n') + lno++; + } while (c != EOF && c_isspace(c)); if (c == EOF) break; if (c == '#') { do { c= getchar(); if (c == '\n') lno++; } while (c != EOF && c != '\n'); @@ -141,7 +145,7 @@ setselections(const char *const *argv) } varbuf_reset(&namevb); - while (!isspace(c)) { + while (!c_isspace(c)) { varbuf_add_char(&namevb, c); c= getchar(); if (c == EOF) ohshit(_("unexpected eof in package name at line %d"),lno); @@ -149,14 +153,14 @@ setselections(const char *const *argv) } varbuf_end_str(&namevb); - while (c != EOF && isspace(c)) { + while (c != EOF && c_isspace(c)) { c= getchar(); if (c == EOF) ohshit(_("unexpected eof after package name at line %d"),lno); if (c == '\n') ohshit(_("unexpected end of line after package name at line %d"),lno); } varbuf_reset(&selvb); - while (c != EOF && !isspace(c)) { + while (c != EOF && !c_isspace(c)) { varbuf_add_char(&selvb, c); c= getchar(); } @@ -164,7 +168,7 @@ setselections(const char *const *argv) while (c != EOF && c != '\n') { c= getchar(); - if (!isspace(c)) + if (!c_isspace(c)) ohshit(_("unexpected data after package and selection at line %d"),lno); } pkg = pkg_spec_parse_pkg(namevb.buf, &err); diff --git a/src/unpack.c b/src/unpack.c index 954b6b549..bdd16f1b1 100644 --- a/src/unpack.c +++ b/src/unpack.c @@ -30,7 +30,6 @@ #include <assert.h> #include <errno.h> -#include <ctype.h> #include <string.h> #include <time.h> #include <utime.h> @@ -42,6 +41,7 @@ #include <stdio.h> #include <dpkg/i18n.h> +#include <dpkg/c-ctype.h> #include <dpkg/dpkg.h> #include <dpkg/dpkg-db.h> #include <dpkg/pkg.h> @@ -229,7 +229,7 @@ deb_parse_conffiles(struct pkginfo *pkg, const char *control_conffiles, if (p[-1] != '\n') ohshit(_("conffile name '%s' is too long, or missing final newline"), conffilenamebuf); - while (p > conffilenamebuf && isspace(p[-1])) + while (p > conffilenamebuf && c_isspace(p[-1])) --p; if (p == conffilenamebuf) continue; |