From ebea092ddd341c9654645bdbb0e1a8e9d0faf564 Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Sat, 25 Feb 2017 20:00:02 +0200 Subject: [PATCH] Move x.{c,h} to a different subdirectory x.c has grown into an unmaintainable blob. Moving it in its own subdirectory is the first step to splitting it into submodules each of which will have a well defined job so that a lot of the code can be abstracted to improve readability and make it much easier to maintain. This process will be done one small part at a time only when we need to change significantly change a part of the file, there is no need to break what already works. --- Makefile | 8 ++++---- src/dunst.c | 2 +- src/notification.c | 2 +- src/settings.h | 2 +- src/{ => x11}/x.c | 10 +++++----- src/{ => x11}/x.h | 0 6 files changed, 12 insertions(+), 12 deletions(-) rename src/{ => x11}/x.c (99%) rename src/{ => x11}/x.h (100%) diff --git a/Makefile b/Makefile index 3902c62..01c0662 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ include config.mk CFLAGS += -I. LDFLAGS += -L. -SRC = $(shell ls src/*.c) -OBJ = ${SRC:.c=.o} +SRC := $(shell find src/ -name '*.c') +OBJ := ${SRC:.c=.o} all: doc dunst service @@ -76,8 +76,8 @@ uninstall: test: test/test cd test && ./test -TEST_SRC = $(shell ls test/*.c) -TEST_OBJ = $(TEST_SRC:.c=.o) +TEST_SRC := $(shell find test/ -name '*.c') +TEST_OBJ := $(TEST_SRC:.c=.o) test/test: ${OBJ} ${TEST_OBJ} ${CC} ${CFLAGS} -o $@ ${TEST_OBJ} ${OBJ} ${LDFLAGS} diff --git a/src/dunst.c b/src/dunst.c index 3a6008c..9f2c0b9 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -19,7 +19,7 @@ #include "notification.h" #include "option_parser.h" #include "settings.h" -#include "x.h" +#include "x11/x.h" #define LENGTH(X) (sizeof X / sizeof X[0]) diff --git a/src/notification.c b/src/notification.c index 930a0f8..1ccb7c1 100644 --- a/src/notification.c +++ b/src/notification.c @@ -21,7 +21,7 @@ #include "rules.h" #include "settings.h" #include "utils.h" -#include "x.h" +#include "x11/x.h" int next_notification_id = 1; diff --git a/src/settings.h b/src/settings.h index 160da14..a5097f6 100644 --- a/src/settings.h +++ b/src/settings.h @@ -4,7 +4,7 @@ #include -#include "x.h" +#include "x11/x.h" enum alignment { left, center, right }; enum icon_position_t { icons_left, icons_right, icons_off }; diff --git a/src/x.c b/src/x11/x.c similarity index 99% rename from src/x.c rename to src/x11/x.c index b8745d0..9a2a5c8 100644 --- a/src/x.c +++ b/src/x11/x.c @@ -25,11 +25,11 @@ #include #include -#include "dunst.h" -#include "markup.h" -#include "notification.h" -#include "settings.h" -#include "utils.h" +#include "src/dunst.h" +#include "src/markup.h" +#include "src/notification.h" +#include "src/settings.h" +#include "src/utils.h" #define WIDTH 400 #define HEIGHT 400 diff --git a/src/x.h b/src/x11/x.h similarity index 100% rename from src/x.h rename to src/x11/x.h