On Fri, 27 Jan 2012 10:34:19 +0000, Carlos R. Mafra wrote:
On Fri, 27 Jan 2012 at  0:31:49 +0100, Rodolfo kix Garcia wrote:

Subject: [PATCH 01/24] WindowMaker: Display dpy externs removed

The Display variable dpy is moved to WindowMaker.h, therefore the externs can be removed.
---
 src/WindowMaker.h |    2 +-
 src/main.c        |    2 --
 src/xmodifier.c   |    3 +--
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 9e2c5f4..47e60f8 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -444,7 +444,7 @@ typedef struct WPreferences {


 /****** Global Variables  ******/
-extern Display *dpy;
+Display        *dpy;

I don't think this is right. The variable was defined in main.c and now
you are defining it here?

Yes, is ok. The variable dpy is used in a lot of files. WindowMaker.h is included in all of them. Therefore, IMO, is better to remove the externs and make the definition in one place common for all files. Really, the variable dpy don't "belongs" to main.c/h, is common to the full source code.

If you think in that, when the file is included by the preprocessor, is somethinkg like:

/* From WindowMaker.h */
...
extern Display *dpy;
...
/* From main.c */
...
Display *.dpy;
...

Now, the code is:

/* From WindowMaker.h */
...
Display *dpy;
...
/* From main.c */
...
(nothing)
...

Does it compile?

Of course. All patches has been compiled and I ran the wmaker binary with every modification.

For this reason, not all externs has been removed. There are some externs in a macro at WindowMaker.h, but I prefer wait to make this change. Other extern is yes with a WINGs variable.

Please, try it :-)

kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to [email protected].

Reply via email to