diff options
author | Michael Vogt <mvo@debian.org> | 2014-01-28 16:43:49 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-01-28 16:43:49 +0100 |
commit | acead5b93cf49ab33cba4be2ea8e1b253ed0f2bf (patch) | |
tree | 7c8631716d2182c7891533a0e4ce3b6962595f17 /ftparchive/override.cc | |
parent | f4a631adf2f14c99d61ecb7f61cb1b3625c1cde4 (diff) | |
parent | bae81c1307e956aa8928c9d6a77830fb733cd61f (diff) |
Merge branch 'debian/sid' into ubuntu/master
Diffstat (limited to 'ftparchive/override.cc')
-rw-r--r-- | ftparchive/override.cc | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/ftparchive/override.cc b/ftparchive/override.cc index 4db6e8e7a..beedf5d73 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -52,45 +52,41 @@ bool Override::ReadOverride(string const &File,bool const &Source) 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) |