Paul Tan <pyoka...@gmail.com> writes:

> So the fix would be to remove the assert()s, as follows:

What I pushed out tonight should have SQUASH??? (or fixup!) that
splits this into appropriate steps in your series.  Please check.

Note that you do not have to say "if the variable has something,
then free it".  free(NULL) is perfectly fine and we can read

        free(var);
        var = compute_new_value();

just fine.

However, I am reluctant to blindly replace assert(!state->field)
with free(state->field).  Are there cases where we _must_ call a
function that sets these fields at most once?

On the other hand, assert() like this is more or less useless.

        assert(state->field);
        ...
        printf("%s", state->field); /* or other uses */

"The caller must have filled the field" can be seen by unconditional
use of "state->field" without such an assert().
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to