2006-03-03 Josh Stone <joshua.i.stone@intel.com>
* main.cxx (main): search forward for dashes in the kernel release,
- to work properly with release names with more than one dash.
+ to work properly with release names with more than one dash. Also
* parse.cxx (eval_pp_conditional): ditto
* tapsets.cxx (profile_derived_probe::profile_derived_probe): ditto
* safety/safety.py (StaticSafety::__build_search_suffixes): ditto,
and add copyright & GPL tag
+ PR 2390
+ * main.cxx (main): expand search path so that revision w.x.y.z
+ searches w.x.y.z, w.x.y, and w.x.
+
2006-03-03 Frank Ch. Eigler <fche@elastic.org>
* tapset/indent.stp, indent-default.stp: New little tapset.
// Construct arch / kernel-versioning search path
vector<string> version_suffixes;
- const string& kvr = s.kernel_release;
+ string kvr = s.kernel_release;
const string& arch = s.architecture;
// add full kernel-version-release (2.6.NN-FOOBAR) + arch
version_suffixes.push_back ("/" + kvr + "/" + arch);
// add kernel version (2.6.NN) + arch
string::size_type dash_index = kvr.find ('-');
if (dash_index > 0 && dash_index != string::npos) {
- version_suffixes.push_back ("/" + kvr.substr (0, dash_index) + "/" + arch);
- version_suffixes.push_back ("/" + kvr.substr (0, dash_index));
+ kvr.erase(dash_index);
+ version_suffixes.push_back ("/" + kvr + "/" + arch);
+ version_suffixes.push_back ("/" + kvr);
}
// add kernel family (2.6) + arch
- string::size_type dot_index = kvr.find ('.');
- string::size_type dot2_index = kvr.find ('.', dot_index+1);
- if (dot2_index > 0 && dot2_index != string::npos) {
- version_suffixes.push_back ("/" + kvr.substr (0, dot2_index) + "/" + arch);
- version_suffixes.push_back ("/" + kvr.substr (0, dot2_index));
+ string::size_type dot1_index = kvr.find ('.');
+ string::size_type dot2_index = kvr.rfind ('.');
+ while (dot2_index > dot1_index && dot2_index != string::npos) {
+ kvr.erase(dot2_index);
+ version_suffixes.push_back ("/" + kvr + "/" + arch);
+ version_suffixes.push_back ("/" + kvr);
+ dot2_index = kvr.rfind ('.');
}
// add architecture search path
version_suffixes.push_back("/" + arch);