summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-12-27 00:42:37 +0100
committerJulian Andres Klode <jak@debian.org>2015-12-27 00:42:37 +0100
commit98b063439156595f74c89e923bf4d3fd51a3b36f (patch)
tree57c4c511b329b0d1b415070d8b877fa12284dbfd /apt-pkg/contrib/strutl.cc
parent333e0f956c811cebee58b53f49952f129f4f860a (diff)
Introduce isspace_ascii() for use by parsers
This is like isspace(), but ignores the current locale.
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r--apt-pkg/contrib/strutl.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 396cb7898..392412e52 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1378,6 +1378,23 @@ int tolower_ascii(int const c)
}
/*}}}*/
+// isspace_ascii - isspace() function that ignores the locale /*{{{*/
+// ---------------------------------------------------------------------
+/* This little function is one of the most called methods we have and tries
+ therefore to do the absolut minimum - and is notable faster than
+ standard isspace() and as a bonus avoids problems with different
+ locales - we only operate on ascii chars anyway. */
+int isspace_ascii(int const c)
+{
+ return (c == ' '
+ || c == '\f'
+ || c == '\n'
+ || c == '\r'
+ || c == '\t'
+ || c == '\v');
+}
+ /*}}}*/
+
// CheckDomainList - See if Host is in a , separate list /*{{{*/
// ---------------------------------------------------------------------
/* The domain list is a comma separate list of domains that are suffix