From 39c7beba375a57eec8fa761b10455b3f5c20302a Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sun, 9 Feb 2020 12:20:53 +0900 Subject: [PATCH] timer: add Quark object to report any error Signed-off-by: Takashi Sakamoto --- src/timer/meson.build | 12 +++++++++--- src/timer/privates.h | 15 +++++++++++++++ src/timer/query.c | 6 ++++++ src/timer/query.h | 12 ++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 src/timer/privates.h create mode 100644 src/timer/query.c create mode 100644 src/timer/query.h diff --git a/src/timer/meson.build b/src/timer/meson.build index 51a1711..e46f0b6 100644 --- a/src/timer/meson.build +++ b/src/timer/meson.build @@ -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 index 0000000..9f5666f --- /dev/null +++ b/src/timer/privates.h @@ -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 index 0000000..d112a5f --- /dev/null +++ b/src/timer/query.c @@ -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 index 0000000..ec3d941 --- /dev/null +++ b/src/timer/query.h @@ -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 +#include + +G_BEGIN_DECLS + +G_END_DECLS + +#endif -- 2.47.3