]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Added configurable error handlers.
authorJaroslav Kysela <perex@perex.cz>
Sat, 25 Nov 2000 16:36:18 +0000 (16:36 +0000)
committerJaroslav Kysela <perex@perex.cz>
Sat, 25 Nov 2000 16:36:18 +0000 (16:36 +0000)
include/Makefile.am
include/error.h
include/global.h [new file with mode: 0644]
include/header.h
src/error.c

index a930d93aac6c233ad38764fb4fbda73c94613ac4..9b0b5907838f15c60730f0240dd82c57f90a0fc6 100644 (file)
@@ -3,8 +3,9 @@ sysinclude_HEADERS = asoundlib.h
 
 # This is the order they will be concatenated into asoundlib.h!
 #
-header_files=header.h version.h error.h control.h mixer.h pcm.h rawmidi.h \
-             timer.h hwdep.h seq.h seqmid.h conv.h instr.h conf.h footer.h
+header_files=header.h version.h global.h error.h control.h mixer.h pcm.h \
+             rawmidi.h timer.h hwdep.h seq.h seqmid.h conv.h instr.h conf.h \
+            footer.h
 
 noinst_HEADERS=$(header_files) search.h list.h aserver.h
 
index eb666addeead2e47648b8d7f7dc6c08879e285a4..d13046d42d09c4e49f920a07788edebf0257559d 100644 (file)
@@ -11,6 +11,10 @@ extern "C" {
 
 const char *snd_strerror(int errnum);
 
+typedef void (snd_lib_error_handler_t)(const char *file, int line, const char *function, int err, const char *fmt, ...) /* __attribute__ ((weak, format (printf, 5, 6))) */;
+extern snd_lib_error_handler_t *snd_lib_error;
+extern int snd_lib_error_set_handler(snd_lib_error_handler_t *handler);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/global.h b/include/global.h
new file mode 100644 (file)
index 0000000..c3ab7b9
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ *  Global defines
+ */
+
+#define SND_DEV_TYPE_PCM       0
+#define SND_DEV_TYPE_CONTROL   1
+#define SND_DEV_TYPE_RAWMIDI   2
+#define SND_DEV_TYPE_TIMER     3
+#define SND_DEV_TYPE_HWDEP     4
+#define SND_DEV_TYPE_SEQ       5
+
+#define SND_TRANSPORT_TYPE_SHM 0
+#define SND_TRANSPORT_TYPE_TCP 1
+
index 8ce91f67f94e989462bf967ad148d9a534b3cd9f..51648a9506f08446e9f54f0d8dc9bd0a826c517b 100644 (file)
 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
 #endif
 
-#define SND_DEV_TYPE_PCM       0
-#define SND_DEV_TYPE_CONTROL   1
-#define SND_DEV_TYPE_RAWMIDI   2
-#define SND_DEV_TYPE_TIMER     3
-#define SND_DEV_TYPE_HWDEP     4
-#define SND_DEV_TYPE_SEQ       5
-
-#define SND_TRANSPORT_TYPE_SHM 0
-#define SND_TRANSPORT_TYPE_TCP 1
-
-extern void snd_lib_error(const char *file, int line, const char *function, int err, const char *fmt, ...)  __attribute__ ((weak, format (printf, 5, 6)));
-
index b5871f9a4689a172d47dcbdcecffa98f9ef4ba7e..fa799c05f15e484175262c77e64b449632d63162 100644 (file)
@@ -44,7 +44,7 @@ const char *snd_strerror(int errnum)
        return snd_error_codes[errnum];
 }
 
-void snd_lib_error(const char *file, int line, const char *function, int err, const char *fmt, ...)
+static void snd_lib_error_default(const char *file, int line, const char *function, int err, const char *fmt, ...)
 {
        va_list arg;
        va_start(arg, fmt);
@@ -56,3 +56,10 @@ void snd_lib_error(const char *file, int line, const char *function, int err, co
        va_end(arg);
 }
 
+snd_lib_error_handler_t *snd_lib_error = snd_lib_error_default;
+
+int snd_lib_error_set_handler(snd_lib_error_handler_t *handler)
+{
+       snd_lib_error = handler == NULL ? snd_lib_error_default : handler;
+       return 0;
+}