Yet another talloc wrapper that should come in handy.
char *
xtalloc_asprintf (const void *t, const char *fmt, ...);
+void *
+_xtalloc_reference_loc (const void *context,
+ const void *ptr, const char *location);
+
+#define xtalloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_xtalloc_reference_loc((ctx),(ptr), __location__)
+
#endif
va_end(ap);
return ret;
}
+
+void *
+_xtalloc_reference_loc (const void *context,
+ const void *ptr, const char *location)
+{
+ void *ret;
+
+ ret = _talloc_reference_loc (context, ptr, location);
+ if (ret == NULL) {
+ fprintf (stderr, "Out of memory.\n");
+ exit (1);
+ }
+
+ return ret;
+}