+
+int xasprintf(char **strp, const char *fmt, ...) {
+ int result;
+ va_list ap;
+ va_start(ap, fmt);
+ result = xvasprintf(strp, fmt, ap);
+ va_end(ap);
+ return result;
+}
+
+int xvasprintf(char **strp, const char *fmt, va_list ap) {
+ int result = vasprintf(strp, fmt, ap);
+ if(result < 0) {
+ fprintf(stderr, "vasprintf() failed: %s\n", strerror(errno));
+ exit(xalloc_exit_failure);
+ }
+ return result;
+}