Re: [PATCH 08/26] diff.c: migrate emit_line_checked to use emit_diff_symbol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Beller <sbeller@xxxxxxxxxx> writes:

> Actually that function already has some quick return:
>
> static int new_blank_line_at_eof(struct emit_callback *ecbdata, const
> char *line, int len)
> {
>     if (!((ecbdata->ws_rule & WS_BLANK_AT_EOF) &&
>          ecbdata->blank_at_eof_in_preimage &&
>          ecbdata->blank_at_eof_in_postimage &&
>          ecbdata->blank_at_eof_in_preimage <= ecbdata->lno_in_preimage &&
>          ecbdata->blank_at_eof_in_postimage <= ecbdata->lno_in_postimage))
>                   return 0;
>     return ws_blank_line(line, len, ecbdata->ws_rule);
> }

I wouldn't call the first if() statement "quick return".  It
probably weighs as much as ws_blank_line() itself, which is not that
expensive.  

Even though new_blank_line_at_eof() may have been coded efficiently
and not very expensive as a whole, the fact remains that it didn't
get called when we know it was unneeded, and it now will get called
before we figure out if it is necessary.

And that is why I said it is a bit unsatisfactory (as opposed to
"horrible" or with other more severe adjective).





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux