[Rpm-maint] Plugin ponderings

Panu Matilainen pmatilai at laiskiainen.org
Wed Dec 5 12:53:50 UTC 2012


On 12/05/2012 01:31 PM, Reshetova, Elena wrote:
> Hi,
>
> Sorry for the delay: got buried with other stuff :(
>
> Here is the corrected version of the patch:
> - cleaned up hygiene
> - removed any additional "goto" labels: for tsm made it like you suggested
> with just variable, for psm, it seemed cleaner to put the psm calls inside of
> if(), but I can also make it with variable or name goto label, smth like
> "postpsm".
> - removed the void checking of postsm hook return value (I wanted actually to
> do it before, but it slipped through :()

Looks good to me except for one minor nit:

     int TsmPre = -1; /* TsmPre hook hasn't been called */

For variables of boolean nature, its better to stick to 0/1 values and 
name them in a way that makes the code read almost like plain English so 
it doesn't really even need comments. Not that comments are bad but its 
even better if the code documents itself :) Eg:

     int TsmPreDone = 0;

     [...]

     TsmPreDone = 1;
     if (rpmpluginsCallTsmPre(ts->plugins, ts)

     [...]

     if (TsmPreDone)
         rpmpluginsCallTsmPost(ts->plugins, ts, rc);


	- Panu -


More information about the Rpm-maint mailing list