Perhaps all nmh's platforms cope with free(3) these days, but it gives
symmetry with the other mh_x* memory functions and if there is code
testing the pointer before calling free then it can use this instead.
/* Call calloc(3), exiting on NULL return. */
void *mh_xcalloc(size_t, size_t);
+/* Call free(3), if ptr isn't NULL. */
+void mh_xfree(void *ptr);
+
char *pwd(void);
char *add(const char *, char *);
char *addlist(char *, const char *);
return p;
}
+/* Call free(3), if ptr isn't NULL. */
+void mh_xfree(void *ptr)
+{
+ if (ptr)
+ free(ptr); /* Some very old platforms can't cope with NULL. */
+}
+
/*
* Return the present working directory, if the current directory does not
* exist, or is too long, make / the pwd.