]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: add Quark object to report any error
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 9 Feb 2020 03:20:53 +0000 (12:20 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Tue, 11 Feb 2020 04:28:18 +0000 (13:28 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/timer/meson.build
src/timer/privates.h [new file with mode: 0644]
src/timer/query.c [new file with mode: 0644]
src/timer/query.h [new file with mode: 0644]

index 51a17110e72a006f167e60b784508fd132988ace..e46f0b63655c2593516279a1a069b52916e57f50 100644 (file)
@@ -8,11 +8,17 @@ namespace = 'ALSATimer'
 has_enumerations = true
 has_marshaller = false
 
-sources = files()
+sources = files(
+  'query.c',
+)
 
-headers = files()
+headers = files(
+  'query.h',
+)
 
-privates = files()
+privates = files(
+  'privates.h',
+)
 
 #
 # Common part except for identifier of dependency.
diff --git a/src/timer/privates.h b/src/timer/privates.h
new file mode 100644 (file)
index 0000000..9f5666f
--- /dev/null
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#ifndef __ALSA_GOBJECT_ALSATIMER_PRIVATES__H__
+#define __ALSA_GOBJECT_ALSATIMER_PRIVATES__H__
+
+G_BEGIN_DECLS
+
+GQuark alsatimer_error_quark(void);
+
+#define generate_error(err, errno)                              \
+    g_set_error(err, alsatimer_error_quark(), errno,            \
+                __FILE__ ":%d: %s", __LINE__, strerror(errno))
+
+G_END_DECLS
+
+#endif
diff --git a/src/timer/query.c b/src/timer/query.c
new file mode 100644 (file)
index 0000000..d112a5f
--- /dev/null
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#include "query.h"
+#include "privates.h"
+
+// For error handling.
+G_DEFINE_QUARK("alsatimer-error", alsatimer_error)
diff --git a/src/timer/query.h b/src/timer/query.h
new file mode 100644 (file)
index 0000000..ec3d941
--- /dev/null
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#ifndef __ALSA_GOBJECT_ALSATIMER_QUERY__H__
+#define __ALSA_GOBJECT_ALSATIMER_QUERY__H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+G_END_DECLS
+
+#endif