[pacman-dev] [PATCH 3/5] be_pacakge: Refactor handling of simple path checks

Florian Pritz bluewind at xinu.at
Tue Jan 28 04:56:23 EST 2014


On 28.01.2014 00:31, Dan McGee wrote:
>> +static int handle_simple_path(alpm_pkg_t *pkg, const char *path)
>> +{
>> +       if(strcmp(path, ".INSTALL") == 0) {
>> +               pkg->scriptlet = 1;
>> +       } else {
>> +               return 0;
>> +       }
>> +
>> +       return 1;
>>
> This felt a little weird to read and understand the flow. Why not just
> `return 1` from in the if block, drop the else completely, and return 0 at
> the end of the function?

The idea was to make it easy to expand to more files (no need to
remember to add returns), but I guess YAGNI and yeah not really readable.

Will be fixed in the next patch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/pacman-dev/attachments/20140128/d0656e44/attachment.asc>


More information about the pacman-dev mailing list