Stefan Beller <sbel...@google.com> 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).


Reply via email to