> What's your thinking behind this? To me this seems like a perfectly
> rational and well motivated function to have, both for readability and
> rather than having to repeat the same statements several times over in
> the rest of the code, risking future calamity if a change is made in
> one place and not the other...
> 
> I mean, I don't know if I'm unusual, but I often find myself breaking
> out separate functions from larger pieces of code, that may end up
> being called just that one time in a program, just to improve
> readability and keep things logically apart.

The most important thing to note is that this diff removes seven lines.
If you're abstracting something into a function, it definitely shouldn't
be creating more code.

When you create functions for things like if (z) errx(...); conditions,
it makes the code much harder to read. Someone trying to figure out
what's going on has to find the function definition and remember what it
does. Extrapolate this for every two-line error condition, and you have
a major headache. Such functions improve readability only if you're the
one writing them.

So, I wouldn't like this function no matter how many times it was used.
And it only appears twice.

Reply via email to