From: Aki Tuomi Date: Thu, 6 Jul 2017 11:44:40 +0000 (+0300) Subject: lib, lib-storage: Move INOTIFY_ST_CHANGED to ST_CHANGED in lib X-Git-Tag: 2.3.0.rc1~1310 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3aff91a1941ea35265f1e80e70853693e8ec8e0b;p=thirdparty%2Fdovecot%2Fcore.git lib, lib-storage: Move INOTIFY_ST_CHANGED to ST_CHANGED in lib Allows reusing this elsewhere --- diff --git a/src/lib-storage/list/mailbox-list-index-notify.c b/src/lib-storage/list/mailbox-list-index-notify.c index d3516208df..38b132caf4 100644 --- a/src/lib-storage/list/mailbox-list-index-notify.c +++ b/src/lib-storage/list/mailbox-list-index-notify.c @@ -812,19 +812,14 @@ static void notify_now_callback(struct mailbox_list_notify_index *inotify) static void notify_callback(struct mailbox_list_notify_index *inotify) { -#define INOTIFY_ST_CHANGED(last_st, prev_st) \ - ((last_st).st_mtime != (prev_st).st_mtime || \ - ST_MTIME_NSEC(last_st) != ST_MTIME_NSEC(prev_st) || \ - (last_st).st_size != (prev_st).st_size || \ - (last_st).st_ino != (prev_st).st_ino) struct stat list_prev_st = inotify->list_last_st; struct stat inbox_prev_st = inotify->inbox_last_st; notify_update_stat(inotify); - if (INOTIFY_ST_CHANGED(inotify->inbox_last_st, inbox_prev_st)) + if (ST_CHANGED(inotify->inbox_last_st, inbox_prev_st)) inotify->inbox_event_pending = TRUE; if (inotify->inbox_event_pending || - INOTIFY_ST_CHANGED(inotify->list_last_st, list_prev_st)) { + ST_CHANGED(inotify->list_last_st, list_prev_st)) { /* log has changed. call the callback with a small delay to allow bundling multiple changes together */ if (inotify->to_notify != NULL) { diff --git a/src/lib/macros.h b/src/lib/macros.h index a3878b1f00..4f95dc4f98 100644 --- a/src/lib/macros.h +++ b/src/lib/macros.h @@ -235,4 +235,10 @@ #define i_zero(p) memset(p, 0, sizeof(*(p))) #define i_zero_safe(p) safe_memset(p, 0, sizeof(*(p))) +#define ST_CHANGED(st_a, st_b) \ + ((st_a).st_mtime != (st_b).st_mtime || \ + ST_MTIME_NSEC(st_a) != ST_MTIME_NSEC(st_b) || \ + (st_a).st_size != (st_b).st_size || \ + (st_a).st_ino != (st_b).st_ino) + #endif