+STATIC_IF_DEBUG void
+xfree_real (void *ptr)
+{
+ /* Wget's xfree() must not be passed a NULL pointer. This is for
+ historical reasons: many pre-C89 systems were known to bomb at
+ free(NULL), and Wget was careful to use xfree_null when there is
+ a possibility of PTR being NULL. (It might have been better to
+ simply have xfree() do nothing if ptr==NULL.)
+
+ Since the code is already written that way, this assert simply
+ enforces that constraint. Code that thinks it doesn't deal with
+ NULL, and it in fact does, aborts immediately. If you trip on
+ this, either the code has a pointer handling bug or should have
+ called xfree_null instead of xfree. Correctly written code
+ should never trigger this assertion.
+
+ If the assertion proves to be too much of a hassle, it can be
+ removed and a check that makes NULL a no-op placed in its stead.
+ If that is done, xfree_null is no longer needed and should be
+ removed. */
+ assert (ptr != NULL);
+ free (ptr);
+}
+