summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-04-01 23:27:16 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2013-04-01 23:27:16 +0200
commitd9682cf8268d6c69e41adb6be9f03d68ba066a12 (patch)
tree4bd778ef78ff8e9c9c910bfcbcd4bbc0822e8bdb
parentb8a884c0c7d5f670179a82984289140a9f432729 (diff)
micro-optimize and enhance readability of ListParser::VersionHash
-rw-r--r--apt-pkg/deb/deblistparser.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 56d5297fc..67f0ac9c6 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -284,7 +284,7 @@ unsigned short debListParser::VersionHash()
"Replaces",0};
unsigned long Result = INIT_FCS;
char S[1024];
- for (const char **I = Sections; *I != 0; I++)
+ for (const char * const *I = Sections; *I != 0; ++I)
{
const char *Start;
const char *End;
@@ -295,13 +295,13 @@ unsigned short debListParser::VersionHash()
of certain fields. dpkg also has the rather interesting notion of
reformatting depends operators < -> <= */
char *J = S;
- for (; Start != End; Start++)
+ for (; Start != End; ++Start)
{
- if (isspace(*Start) == 0)
- *J++ = tolower_ascii(*Start);
- if (*Start == '<' && Start[1] != '<' && Start[1] != '=')
- *J++ = '=';
- if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
+ if (isspace(*Start) != 0)
+ continue;
+ *J++ = tolower_ascii(*Start);
+
+ if ((*Start == '<' || *Start == '>') && Start[1] != *Start && Start[1] != '=')
*J++ = '=';
}