1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-17 04:14:14 +01:00

wmaker: replaced macro by an inline function, in X Modifier initialisation

A macro can be a source of problems, because the compiler has no type on
the arguments to make checks. Using an inline function allows to do those
checks, meaning clearer error messages, it provides clear info in case of
name collision, it is easier to maintain (no need for the hacky '\' for
multi-lines) and the scope of visibility can be controlled more easily (no
need for #undef).

Took opportunity to change a 0 to the constant NoSymbol which is the name
defined by X for this case and another to NULL which is the right way to
set a null pointer in C.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-12-07 17:10:18 +01:00
committed by Carlos R. Mafra
parent d9438e65ef
commit de00154fa1
2 changed files with 45 additions and 32 deletions

View File

@@ -90,7 +90,6 @@ wmaker_SOURCES = \
xinerama.h \
xinerama.c \
xmodifier.h \
xmodifier.c \
xutil.c \
xutil.h \
wconfig.h \
@@ -125,9 +124,11 @@ wmaker_SOURCES += osdep_stub.c
endif
if USE_NESTED_FUNC
wmaker_SOURCES += misc.c
wmaker_SOURCES += misc.c \
xmodifier.c
else
nodist_wmaker_SOURCES = misc.hack_nf.c
nodist_wmaker_SOURCES = misc.hack_nf.c \
xmodifier.hack_nf.c
CLEANFILES = $(nodist_wmaker_SOURCES)
@@ -135,6 +136,11 @@ misc.hack_nf.c: misc.c $(top_srcdir)/script/nested-func-to-macro.sh
$(AM_V_GEN)$(top_srcdir)/script/nested-func-to-macro.sh \
$(srcdir)/misc.c -o $(builddir)/misc.hack_nf.c \
-f "append_string" -f "append_modifier"
xmodifier.hack_nf.c: xmodifier.c $(top_srcdir)/script/nested-func-to-macro.sh
$(AM_V_GEN)$(top_srcdir)/script/nested-func-to-macro.sh \
$(srcdir)/xmodifier.c -o $(builddir)/xmodifier.hack_nf.c \
-f "modwarn" -f "modbarf" -f "check_modifier"
endif