From bc3c6466ca5a29329f255ad1836c24598e9ae59e Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Tue, 10 Oct 2017 23:11:52 +0200 Subject: [PATCH] Remove LENGTH macro and replace with glib one --- src/dunst.c | 2 -- src/dunst.h | 1 - src/settings.c | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/dunst.c b/src/dunst.c index a933742..18c306f 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -20,8 +20,6 @@ #include "x11/x.h" #include "x11/screen.h" -#define LENGTH(X) (sizeof X / sizeof X[0]) - #ifndef VERSION #define VERSION "version info needed" #endif diff --git a/src/dunst.h b/src/dunst.h index abc1c1f..7b76e93 100644 --- a/src/dunst.h +++ b/src/dunst.h @@ -11,7 +11,6 @@ #define ERR(msg) printf("%s : %d\n", (msg), __LINE__) #define PERR(msg, errnum) printf("(%d) %s : %s\n", __LINE__, (msg), (strerror(errnum))) -#define LENGTH(X) (sizeof X / sizeof X[0]) #define ColLast 3 #define ColFrame 2 diff --git a/src/settings.c b/src/settings.c index 4f66bc9..b10ff9c 100644 --- a/src/settings.c +++ b/src/settings.c @@ -598,7 +598,7 @@ void load_settings(char *cmdline_config_path) ); /* push hardcoded default rules into rules list */ - for (int i = 0; i < LENGTH(default_rules); i++) { + for (int i = 0; i < G_N_ELEMENTS(default_rules); i++) { rules = g_slist_insert(rules, &(default_rules[i]), -1); }