Re:Curl doesn’t spew binary anymore
by userbinator on Saturday June 17, 2017 @11:33AM
(#14576301)
I would agree as well that the code looks great and quite "idiomatic C"; but I'd prefer using 2048 and put the memchr() in the same if with another &&.
[ Parent
| on HN ]
What's the advantage of 2048 over 2000?
I think putting the memchr() in the same if would cause unnecessary calling of the memch() function (and scanning of 2000 bytes) even when any of the other conditions is false! It will work great on a language like ruby, not C.
Re:Curl doesn’t spew binary anymore
by userbinator on Saturday June 17, 2017 @12:28PM
(#14576523)
C && is short-circuit-evaluated. Something like 'if (y && (k = x/y))' won't crash if y is 0.