2 * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
4 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation;
8 * version 2.1 of the License (not later!)
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 Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, see <http://www.gnu.org/licenses>
18 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 /* Can be overridden */
26 void die(const char *fmt, ...);
27 void *malloc_or_die(unsigned int size);
28 void warning(const char *fmt, ...);
29 void pr_stat(const char *fmt, ...);
30 void vpr_stat(const char *fmt, va_list ap);
32 /* Always available */
33 void __die(const char *fmt, ...);
34 void __warning(const char *fmt, ...);
35 void __pr_stat(const char *fmt, ...);
37 void __vdie(const char *fmt, ...);
38 void __vwarning(const char *fmt, ...);
39 void __vpr_stat(const char *fmt, ...);
41 #define min(x, y) ({ \
42 typeof(x) _min1 = (x); \
43 typeof(y) _min2 = (y); \
44 (void) (&_min1 == &_min2); \
45 _min1 < _min2 ? _min1 : _min2; })
47 static inline char *strim(char *string)
54 if (!isspace(*string))
60 string = ret + strlen(ret) - 1;
61 while (string > ret) {
62 if (!isspace(*string))
71 static inline int has_text(const char *text)