summaryrefslogtreecommitdiff
path: root/ftparchive/override.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-02-27 22:52:34 +0100
committerMichael Vogt <mvo@debian.org>2014-02-27 22:52:34 +0100
commitfce69e7a0f38299c57ef96ae1c1dd9a5379bfd5a (patch)
treebe7d18baa836e9df166ec63f6c9fe6f94bb84b40 /ftparchive/override.cc
parenta5e790985752c6820e08e7a7e650e1607fa826e4 (diff)
parentfc104da6a583736223b2f941e43a05ea26b63a7d (diff)
Merge branch 'debian/sid' into debian/experimental
Conflicts: apt-private/private-list.cc configure.ac debian/apt.install.in debian/changelog
Diffstat (limited to 'ftparchive/override.cc')
-rw-r--r--ftparchive/override.cc58
1 files changed, 27 insertions, 31 deletions
diff --git a/ftparchive/override.cc b/ftparchive/override.cc
index 760c20120..d2130db8a 100644
--- a/ftparchive/override.cc
+++ b/ftparchive/override.cc
@@ -49,48 +49,44 @@ bool Override::ReadOverride(string const &File,bool const &Source)
// Strip space leading up to the package name, skip blank lines
char *Pkg = Line;
for (; isspace(*Pkg) && *Pkg != 0;Pkg++);
- if (Pkg == 0)
+ if (*Pkg == 0)
continue;
+#define APT_FIND_NEXT_FIELD \
+ for (End++; isspace(*End) != 0 && *End != 0; ++End) \
+ /* skip spaces */ ; \
+ Start = End; \
+ for (; isspace(*End) == 0 && *End != 0; ++End) \
+ /* find end of word */ ;
+
+#define APT_WARNING_MALFORMED_LINE(FIELD) \
+ if (*End == 0) \
+ { \
+ _error->Warning(_("Malformed override %s line %llu (%s)"),File.c_str(), \
+ Counter, FIELD ); \
+ continue; \
+ } \
+ *End = 0;
+
// Find the package and zero..
- char *Start = Pkg;
+ char *Start;
char *End = Pkg;
for (; isspace(*End) == 0 && *End != 0; End++);
- if (*End == 0)
- {
- _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(),
- Counter);
- continue;
- }
- *End = 0;
+ APT_WARNING_MALFORMED_LINE("pkgname");
+
+ APT_FIND_NEXT_FIELD;
// Find the priority
if (Source == false)
{
- for (End++; isspace(*End) != 0 && *End != 0; End++);
- Start = End;
- for (; isspace(*End) == 0 && *End != 0; End++);
- if (*End == 0)
- {
- _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(),
- Counter);
- continue;
- }
- *End = 0;
+ APT_WARNING_MALFORMED_LINE("priority");
Itm.Priority = Start;
+
+ APT_FIND_NEXT_FIELD;
}
-
+
// Find the Section
- for (End++; isspace(*End) != 0 && *End != 0; End++);
- Start = End;
- for (; isspace(*End) == 0 && *End != 0; End++);
- if (*End == 0)
- {
- _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(),
- Counter);
- continue;
- }
- *End = 0;
+ APT_WARNING_MALFORMED_LINE("section");
Itm.FieldOverride["Section"] = Start;
// Source override files only have the two columns
@@ -99,7 +95,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
Mapping[Pkg] = Itm;
continue;
}
-
+
// Find the =>
for (End++; isspace(*End) != 0 && *End != 0; End++);
if (*End != 0)