utils: Turn number of weekdays into a macro

While "7" may be obvious in the context of calendaring that
it represents the number of week days, it often gives me the
impression of it being a magic number when I'm hyperfocused on certain
parts of the codebase for several consecutive hours. Turning the
number into a macro helps me scan functions much more easily.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/674>
This commit is contained in:
Hari Rana
2026-03-08 21:53:40 -04:00
parent da7b625e18
commit 50e048c7e0
14 changed files with 109 additions and 107 deletions
+2 -1
View File
@@ -26,9 +26,10 @@
#include <libecal/libecal.h>
#include <libgweather/gweather.h>
#define N_WEEKDAYS 7
#define ALIGNED(x) (round (x) + 0.5)
#define MINUTES_PER_DAY 1440
#define MAX_MINUTES (7 * MINUTES_PER_DAY)
#define MAX_MINUTES (N_WEEKDAYS * MINUTES_PER_DAY)
#define gcal_clear_timeout(pp) { if (pp && *pp) { g_source_remove (*pp); *pp = 0; } }
#define gcal_clear_signal_handler(pp,instance) { if (pp && *pp > 0) { g_signal_handler_disconnect (instance, *pp); *pp = 0; } }