]> git.cworth.org Git - ttt/blob - src/x.h
2005-11-07 Carl Worth <cworth@cworth.org>
[ttt] / src / x.h
1 /* x.c - Some wrappers for various functions to check and exit on out-of-memory
2  *
3  * Copyright © 2005 Carl Worth
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  *
19  * Author: Carl Worth <carl@theworths.org>
20  */
21
22 #ifndef _X_H_
23 #define _X_H_
24
25 void
26 xasprintf (char **strp, const char *fmt, ...) TTT_PRINTF_FORMAT(2, 3);
27
28 void
29 xvasprintf (char **strp, const char *fmt, va_list ap);
30
31 void
32 xpipe (int filedes[2]);
33
34 pid_t
35 xfork (void);
36
37 void *
38 xmalloc (size_t size);
39
40 void *
41 xcalloc (size_t nmemb, size_t size);
42
43 void *
44 xrealloc (void *ptr, size_t size);
45
46 FILE *
47 xfdopen (int filedes, const char *mode);
48
49 char *
50 xstrdup (const char *s);
51
52 void
53 xfwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
54
55 #endif /* _X_H_ */