[Merge] lp:~sergiusens/nuntium/encoder_loop into lp:nuntium
Sergio Schvezov
sergio.schvezov at canonical.com
Fri May 9 12:30:46 UTC 2014
On Fri, May 9, 2014 at 6:08 AM, Manuel de la Peña <
manuel.delapena at canonical.com> wrote:
> Review: Needs Fixing
>
> I think we can simplify a little the code. I have noticed that you do
> several times the follwoing pattern:
>
> 61 + if err := enc.setParam(param); err != nil {
> 62 + return err
> 63 + }
> 64 + if err := enc.writeString(s); err != nil {
> 65 + return err
> 66 + }
> 67 + return nil
>
> The second if is not required, we can write the same code liek this:
>
> if err := enc.setParam(param); err != nil {
> return err
> }
>
> return enc.writeString(s)
>
> You have used the same patter in the following methods:
>
> func (enc *MMSEncoder) writeStringParam(param byte, s string) error
> func (enc *MMSEncoder) writeByteParam(param byte, b byte) error
> func (enc *MMSEncoder) writeReportAllowedParam(reportAllowed bool) error
>
> I think it would be nice to remove the extra code because it does not
> bribg anything to the table and by doing so we simplify the code paths and
> reduce the diff.
>
I'll get to that then ;-) I just like things to look the same I guess :-P
Not worried about the compiler as I hope it can optimize; was going for
readability, it's eyes of the beholder :-P
--
https://code.launchpad.net/~sergiusens/nuntium/encoder_loop/+merge/218619
Your team Ubuntu Phablet Team is subscribed to branch lp:nuntium.
More information about the Ubuntu-reviews
mailing list