basic/io-util: invert return value from IOVEC_INCREMENT()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 26 Apr 2021 21:30:26 +0000 (23:30 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 4 May 2021 12:57:49 +0000 (14:57 +0200)
commit32f65484d70e6f749534d176022b1e4760f22ce5
treef1ba714242c331cdec6177c70fb363d111b14278
parent0f6bb1ed05ceba91d8529c74379613ec9ebf50dc
basic/io-util: invert return value from IOVEC_INCREMENT()

We would try to return a value that could be nonzero only if the kernel
reported writing more bytes than we gave to it, hopefully a rare occurence.
Instead, assert that this doesn't happen.

Instead, return true if we got to the end of the iovec array. The caller
can use this information to know that the whole iovec array was written.
This allows one loop to be dropped in write_to_syslog().

Also drop _unlikely_: this function is called with very short arrays, and
it *is* likely that we trigger this condition. Let's just let the compiler
generate normal code without giving it a potentially false hint.
src/basic/io-util.h
src/basic/log.c