diff options
author | Max Kellermann <max@duempel.org> | 2013-08-10 18:02:44 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-04 18:14:22 +0200 |
commit | 29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch) | |
tree | 79766830b55ebca38ddbce84d8d548227eedb69e /src/InotifySource.cxx | |
parent | c9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff) | |
download | mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.gz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.xz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.zip |
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to 'src/InotifySource.cxx')
-rw-r--r-- | src/InotifySource.cxx | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/InotifySource.cxx b/src/InotifySource.cxx index 9a2d4d46d..c6f0ae4db 100644 --- a/src/InotifySource.cxx +++ b/src/InotifySource.cxx @@ -20,6 +20,7 @@ #include "config.h" #include "InotifySource.hxx" #include "util/fifo_buffer.h" +#include "util/Error.hxx" #include "system/fd_util.h" #include "system/FatalError.hxx" @@ -32,15 +33,6 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "inotify" -/** - * A GQuark for GError instances. - */ -static inline GQuark -mpd_inotify_quark(void) -{ - return g_quark_from_static_string("inotify"); -} - bool InotifySource::OnSocketReady(gcc_unused unsigned flags) { @@ -97,13 +89,11 @@ InotifySource::InotifySource(EventLoop &_loop, InotifySource * InotifySource::Create(EventLoop &loop, mpd_inotify_callback_t callback, void *callback_ctx, - GError **error_r) + Error &error) { int fd = inotify_init_cloexec(); if (fd < 0) { - g_set_error(error_r, mpd_inotify_quark(), errno, - "inotify_init() has failed: %s", - g_strerror(errno)); + error.SetErrno("inotify_init() has failed"); return NULL; } @@ -116,13 +106,11 @@ InotifySource::~InotifySource() } int -InotifySource::Add(const char *path_fs, unsigned mask, GError **error_r) +InotifySource::Add(const char *path_fs, unsigned mask, Error &error) { int wd = inotify_add_watch(Get(), path_fs, mask); if (wd < 0) - g_set_error(error_r, mpd_inotify_quark(), errno, - "inotify_add_watch() has failed: %s", - g_strerror(errno)); + error.SetErrno("inotify_add_watch() has failed"); return wd; } |