On Mon, Nov 25, 2019 at 05:57:04PM +0100, Willy Tarreau wrote: > What I'd suggest instead as a better and more durable cleanup would be > to explicitly mention above the function's prototype that it must not > be called with a null err pointer, and remove all "if (err)" or "err &&" > tests so that we are consistent across the whole function. This way it > will be easier to spot any offender. Because even if right now nobody > calls it with a NULL, it suffices to read the first few lines to see > the check being done and believe that it's permitted, so we do have a > latent bug quietly waiting for a victim to pass by.
I also agree with this. Removing all if and "err &&" will make it much more readable as long as it is clearly stated in the function definition. -- William