Stefan Beller [off-list ref] writes:
So as a caller the strbuf is in a different state in case of error
depending whether
the strbuf already had some data in it. I think it would be better if
we only did
`strbuf_setlen(sb_out, oldlen);` here, such that the caller can
strbuf_release it
unconditionally.
If the caller _knows_ that the strbuf is no longer needed, it can
unconditionally call strbuf_release() on it, whether its buffer was
already released or only its length was set to 0, no?
The callee is merely trying to be nice by resetting the strbuf to a
state close to the original in the error return codepath, I would
think. It may be debatable if such a niceness is needed, but it is
a different matter that does not relate to the burden imposed on the
caller.