On Tue, Dec 28, 2010 at 11:20:30AM -0500, [email protected] wrote:
> Go ahead. I checked in what I have.
> I'll lay off for a few days.
Well, I've made a lot of changes -- I'd be grateful if you'd have a look and
ensure I've not botched any CVS conflicts which I had to resolve -- it seems
to work for me, but I might not be testing the same areas as you.
> The cleanups are nice.
> I have a bunch of basic function issues which I've listed at the
> front of the file.
I'll get to those in a bit. I am more interested in cleaning up what's
currently there, as a lot of the inherited xdg-menu code from the SuSE
people is nothing short of abysmal to be frank.
However, the things to take away from my latest commit are:
* Reindented the entire file by hand (because Vim did a piss-poor job) so
that the following "rules" hold true:
- Braces are on a line of their own for all block construct, so for
instance:
sub foo
{
....
}
if (some_condition)
{
....
}
- White space around parenthesis is OK, although consistency is better off
if it's obvious, and as such, I've removed the whte space, so we now
have:
foo(...);
bar(foo(option, option2));
Rather than:
foo( ... );
or even:
foo ( (....) );
- Nested if statements in the form:
if (...)
{
} else {
}
Should be written as:
if (...)
{
}
else
{
}
* In-line logic conditions (if/unless, etc) like this:
foo($bar) unless $baz;
Should be written as such, without the extraneous parenthesis where
applicable -- that is, *not* like this:
foo($bar) unless ($baz);
(It makes it easier to see).
Also, I've seen this sort of thing:
while {$i < $j) { push @bar, $baz++ };
The idiom here is to do:
push @bar, $baz++ while (some_condition);
I am sure there were other things, but these are the main ones.
Now I'll concentrate on removing the hideous amount of duplication we have
between subroutines, refactoring those, and making the code less unwieldy.
:)
-- Thomas Adam
--
"It was the cruelest game I've ever played and it's played inside my head."
-- "Hush The Warmth", Gorky's Zygotic Mynci.