This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: Patch for unattended setup (updated)
- From: Brian Dessent <brian at dessent dot net>
- To: "Dr. Frank Lee" <rl201 at cam dot ac dot uk>
- Cc: cygwin-apps at cygwin dot com
- Date: Sun, 22 Jun 2008 10:11:35 -0700
- Subject: Re: Patch for unattended setup (updated)
- References: <alpine.DEB.0.99.0804091715150.7705@gath> <47FD3D78.706B7B28@dessent.net> <alpine.DEB.0.99.0804100029430.7705@gath> <47FD58BE.EE7CABC3@dessent.net> <alpine.DEB.0.99.0804100105570.7705@gath> <47FD6216.C837C2BC@dessent.net> <alpine.DEB.0.99.0804100151040.7705@gath> <alpine.DEB.0.99.0804101426270.7705@gath> <20080410155937.GA9302@ednor.casa.cgf.cx> <alpine.DEB.0.99.0804101753420.7705@gath> <alpine.DEB.0.99.0804101756520.7705@gath>
- Reply-to: cygwin-apps at cygwin dot com
"Dr. Frank Lee" wrote:
> Apologies, _this_ is the new patch.
> -
> - theLog->exit (0);
> + if (rebootneeded) {
> + theLog->exit (IDS_REBOOT_REQUIRED);
> + } else {
> + theLog->exit (0);
> + }
> }
The GNU style has a brace on its own line.
> + if (unattended_mode) {
Likewise.
> + for_each(packages.begin(), packages.end(), visit_if(mem_fun(&packagemeta::addToCategoryBase), mem_fun(&packagemeta::isManuallyWanted)));
I'm not sure this is very performant. 'isManuallyWanted' is a rather
expensive function and it seems like a waste to have to perform all of
this:
> +static StringOption PackageOption ("", 's', "software", "Software packages to include");
> +
> +bool packagemeta::isManuallyWanted() const
> +{
> + string packages_option = PackageOption;
> + string tname;
> + /* Split the packages listed in the option up */
> + string::size_type loc = packages_option.find(",",0);
> + bool bReturn = false;
> + while ( loc != string::npos ) {
> + tname = packages_option.substr(0,loc);
> + packages_option = packages_option.substr(loc+1);
> + bReturn = bReturn || (name.compare(tname) == 0);
> + loc = packages_option.find(",",0);
> + }
> + /* At this point, no "," exists in packages_option */
> + bReturn = bReturn || (name.compare(packages_option) == 0);
> + return bReturn;
> +}
...once for every instance of every package, which is hundreds.
Couldn't the string parsing stuff be done just once to convert it to a
vector or list, so that it doesn't have to be reparsed over and over?
Brian