[Yum-devel] [PATCH] Clean up unnecessary code

Ville Skyttä ville.skytta at iki.fi
Fri Aug 21 09:01:13 UTC 2009


On Friday 21 August 2009, James Antill wrote:
> On Thu, 2009-08-20 at 23:22 +0300, Ville Skyttä wrote:
> > Hello,
> >
> > The attached patch cleans up some bits of unnecessary/duplicated code. 
> > There should be no functional differences.
>
>  The first one is fine, the second one could you merge the two tests for
> self.files['file'],

I'm not sure what you mean - my patch already merges two such tests/blocks, 
and in the area where it touches code there's only one remaining check for 
files['file'], the other is files['ghost'].  Merging it further with the 
"garbage checks" block above which deals with files['file'] as well could be 
messy or change the behavior of the function.  Or do you mean using something 
like self.files.setdefault('file', []).append(fn)?  This is something that I 
think deserves a separate patchwork throughout the whole codebase, there's a 
lot of that kind of cleanups that could be done.

Note that in the else branch where flag is tested there is only one check for 
self.files['file'], the other one tests 'ghost' in it, not 'file'.

Anyway, the attached revised patch does some further cleanups, maybe this is 
what you meant.

> and can you drop the pkgId bit in the last one.

Not sure which pkgId bit you mean, but I guessed something in the attached 
revised patch.

Note that the hunk that deals with pkgIds is not the last one, there's one 
more in it which removes unused "sql".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Clean-up-unnecessary-duplicated-code.patch
Type: text/x-patch
Size: 3658 bytes
Desc: not available
URL: <http://lists.baseurl.org/pipermail/yum-devel/attachments/20090821/b69b6e69/attachment.bin>


More information about the Yum-devel mailing list