aboutsummaryrefslogtreecommitdiffstats
path: root/util/alevt/misc.h
diff options
context:
space:
mode:
authorMark Purcell <msp@debian.org>2010-02-25 21:13:46 +1100
committeretobi <git@e-tobi.net>2013-09-03 09:48:46 +0200
commit665818f1969f893f05edf5b70eb1804c89b2829e (patch)
tree34ba68cee03c52d769a5a51b456b7e9d63cd091a /util/alevt/misc.h
parent109c7947d6a11a2a54eff1b19615ed80ea2f0602 (diff)
parent9fe4d4ea9c054e539ab679ed2e9c076c35beb69d (diff)
downloadlinux-dvb-apps-3a4100597b16fb9c0845fab3a54b14f0af8aa62b.tar.gz
Imported Debian patch 1.1.1+rev1355-1debian/1.1.1+rev1355-1
Diffstat (limited to '')
-rw-r--r--util/alevt/misc.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/util/alevt/misc.h b/util/alevt/misc.h
new file mode 100644
index 0000000..00a71f8
--- /dev/null
+++ b/util/alevt/misc.h
@@ -0,0 +1,32 @@
+#ifndef MISC_H
+#define MISC_H
+#define PTR (void *)
+#define NELEM(x) ((int)(sizeof(x)/sizeof(*(x))))
+#define NORETURN(x) void x __attribute__((__noreturn__))
+#define DEFINE(x) typeof(x) x
+#define OFFSET_OF(type, elem) ((u8 *)&((type *)0)->elem - (u8 *)0)
+#define BASE_OF(type, elem, p) ((type *)((u8 *)(p) - OFFSET_OF(type, elem)))
+
+#define not !
+#define streq(a, b) (strcmp((a), (b)) == 0)
+#define min(a,b) ({ typeof(a) _a = a; typeof(b) _b = b; _a < _b ? _a : _b; })
+#define max(a,b) ({ typeof(a) _a = a; typeof(b) _b = b; _a > _b ? _a : _b; })
+#define bound(a,b,c) ({ typeof(a) _a = a; typeof(b) _b = b; typeof(c) _c = c; \
+ _b < _a ? _a : _b > _c ? _c : _b; })
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+typedef signed char s8;
+typedef signed short s16;
+typedef signed int s32;
+
+extern char *prgname;
+void setprgname(char *argv_0);
+
+NORETURN(fatal(const char *str, ...));
+NORETURN(fatal_ioerror(const char *str));
+NORETURN(out_of_mem(int size));
+void error(const char *str, ...);
+void ioerror(const char *str);
+#endif