[Rpm-maint] [PATCH] Cleanup: Move similar repeating code in rpmcliArgIter to rpmcliArgIterHelper.
Panu Matilainen
pmatilai at redhat.com
Fri Mar 13 10:30:08 UTC 2009
On Fri, 13 Mar 2009, Rakesh Pandit wrote:
> 2009/3/13 Rakesh Pandit <rakesh.pandit at gmail.com>:
>> Just that I had been looking at usage of rpmgi in query.c did some cleanup.
>>
>
> Sorry posted the old one ... latest one:
> Patch: http://rakesh.fedorapeople.org/rpm/0003--Cleanup-Move-similar-patterns-in-rpmcliArgIter-to.patch
Copy-paste elimination always welcome, just some minor issues/suggestions:
- Please keep alloc+free pairs "symmetric" when possible, eg
rpmcliArgIterHelper() does rpmgiNew() so it should be freed there too,
and as the default case in rpmcliArgIter() makes it's own rpmgiNew()
it should also free it there. With the current patch, the
lone rpmgiFree() in rpmcliArgIter() looks like "umm where did that
come from?"
- Instead of having special logic for RPMDBI_PACKAGES in the helper,
just call rpmcliArgIterHelper() with arg of NULL when it's not going
to be used, this makes it plain obvious when the argv value is not
used at all.
- The indentation of the helper is off from the general style.
- Panu -
More information about the Rpm-maint
mailing list