]> git.cworth.org Git - ttt/blobdiff - src/x.h
2005-11-05 Carl Worth <cworth@cworth.org>
[ttt] / src / x.h
diff --git a/src/x.h b/src/x.h
new file mode 100644 (file)
index 0000000..52c3acd
--- /dev/null
+++ b/src/x.h
@@ -0,0 +1,52 @@
+/* x.c - Some wrappers for various functions to check and exit on out-of-memory
+ *
+ * Copyright © 2005 Carl Worth
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Carl Worth <carl@theworths.org>
+ */
+
+#ifndef _X_H_
+#define _X_H_
+
+void
+xasprintf (char **strp, const char *fmt, ...) WDO_PRINTF_FORMAT(2, 3);
+
+void
+xvasprintf (char **strp, const char *fmt, va_list ap);
+
+void
+xpipe (int filedes[2]);
+
+pid_t
+xfork (void);
+
+void *
+xmalloc (size_t size);
+
+void *
+xcalloc (size_t nmemb, size_t size);
+
+void *
+xrealloc (void *ptr, size_t size);
+
+FILE *
+xfdopen (int filedes, const char *mode);
+
+char *
+xstrdup (const char *s);
+
+#endif /* _X_H_ */