[PATCH XTS 1/2] xts5: remove some more gevent() unnecessities

Peter Hutterer peter.hutterer at who-t.net
Wed Jan 4 21:01:48 PST 2012


Don't declare where not needed, include stdlib where needed, don't cast
where not necessary.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 xts5/Xlib12/XDisplayName/Test1.c           |    2 +-
 xts5/Xlib12/XDisplayName/XDisplayName.m    |    2 +-
 xts5/Xlib14/XUnsetICFocus.m                |    2 +-
 xts5/Xlib14/XmbResetIC.m                   |    2 +-
 xts5/Xlib15/XSetWMProperties/Test1.c       |    2 +-
 xts5/Xlib17/XGetDefault/Test3.c            |    2 +-
 xts5/Xlib17/XGetDefault/Test4.c            |    2 +-
 xts5/Xlib17/XGetDefault/Test5.c            |    4 ++--
 xts5/Xlib17/XGetDefault/XGetDefault.m      |    2 +-
 xts5/Xlib3/XDisplayString/Test1.c          |    2 +-
 xts5/Xlib3/XDisplayString/XDisplayString.m |    2 +-
 xts5/Xlib3/XOpenDisplay/Test1.c            |    2 +-
 xts5/src/libproto/ClientMng.c              |    2 +-
 xts5/src/libproto/XlibNoXtst.c             |    1 -
 14 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/xts5/Xlib12/XDisplayName/Test1.c b/xts5/Xlib12/XDisplayName/Test1.c
index d7f548b..a1bb851 100644
--- a/xts5/Xlib12/XDisplayName/Test1.c
+++ b/xts5/Xlib12/XDisplayName/Test1.c
@@ -154,7 +154,7 @@ char		*str;
 	} else
 		CHECK;
 
-	if((dispstr = getenv("DISPLAY")) == (char *) NULL) {
+	if((dispstr = getenv("DISPLAY")) == NULL) {
 		delete("Environment variable DISPLAY is not set.");
 		return;
 	} else
diff --git a/xts5/Xlib12/XDisplayName/XDisplayName.m b/xts5/Xlib12/XDisplayName/XDisplayName.m
index ff9ea2d..4972d10 100644
--- a/xts5/Xlib12/XDisplayName/XDisplayName.m
+++ b/xts5/Xlib12/XDisplayName/XDisplayName.m
@@ -161,7 +161,7 @@ char	*str;
 char	*dstr;
 char	*mstr = "DISPLAY=%s";
 
-	if((dstr = getenv("DISPLAY")) == (char *) NULL) {
+	if((dstr = getenv("DISPLAY")) == NULL) {
 		delete("DISPLAY configuration variable is not defined.");
 		return;
 	}		
diff --git a/xts5/Xlib14/XUnsetICFocus.m b/xts5/Xlib14/XUnsetICFocus.m
index c005acb..10304af 100644
--- a/xts5/Xlib14/XUnsetICFocus.m
+++ b/xts5/Xlib14/XUnsetICFocus.m
@@ -364,7 +364,7 @@ input is expected on the foucs window attached to that input context.
                 regr_args.l_flags.cleanup = 0;
                 regr_args.l_flags.check = 0;
                 regr_args.l_flags.chksta = 0;
-                if ( (xmodifier = (char *)getenv("XMODIFIERS") ) != (char *)0)
+                if ( (xmodifier = getenv("XMODIFIERS") ) != 0)
                 {
                     XIC ic ;
                     svcUnsetICFocus(ic);
diff --git a/xts5/Xlib14/XmbResetIC.m b/xts5/Xlib14/XmbResetIC.m
index e0365e0..9d92072 100644
--- a/xts5/Xlib14/XmbResetIC.m
+++ b/xts5/Xlib14/XmbResetIC.m
@@ -344,7 +344,7 @@ A call to xname shall reset an input context to its initial state.
                 regr_args.l_flags.cleanup = 1;
                 regr_args.l_flags.check = 1;
                 regr_args.l_flags.chksta = 0;
-                if ( (xmodifier = (char *)getenv("XMODIFIERS") ) != (char *)0)
+                if ( (xmodifier = getenv("XMODIFIERS") ) != NULL)
                 {
                     XIM  input_method ;
                     XIC  input_context ;
diff --git a/xts5/Xlib15/XSetWMProperties/Test1.c b/xts5/Xlib15/XSetWMProperties/Test1.c
index ed0dae4..7c2cf28 100644
--- a/xts5/Xlib15/XSetWMProperties/Test1.c
+++ b/xts5/Xlib15/XSetWMProperties/Test1.c
@@ -154,7 +154,7 @@ XClassHint	rclass_hints;
 	class_hints.res_name = NULL;
 	class_hints.res_class = "XTest_Undefined.";
 
-	if( (res_name = (char *) getenv("RESOURCE_NAME")) == NULL) {
+	if( (res_name = getenv("RESOURCE_NAME")) == NULL) {
 		delete("RESOURCE_NAME environment variable is not set.");
 		return;
 	} else
diff --git a/xts5/Xlib17/XGetDefault/Test3.c b/xts5/Xlib17/XGetDefault/Test3.c
index 27e003d..05ba128 100644
--- a/xts5/Xlib17/XGetDefault/Test3.c
+++ b/xts5/Xlib17/XGetDefault/Test3.c
@@ -149,7 +149,7 @@ char		*pval="XTest.testval31:pval_a\nXTest.testval32:pval_b\nXTest.testval33:pva
 	tpstartup();
 	trace("Exec'd file ./Test3.");
 
-	if(getenv("HOME") == (char *) NULL) {
+	if(getenv("HOME") == NULL) {
 		delete("Environment variable \"HOME\" is not set.");
 		return;
 	} else
diff --git a/xts5/Xlib17/XGetDefault/Test4.c b/xts5/Xlib17/XGetDefault/Test4.c
index bac3533..958fa91 100644
--- a/xts5/Xlib17/XGetDefault/Test4.c
+++ b/xts5/Xlib17/XGetDefault/Test4.c
@@ -152,7 +152,7 @@ static	char	*result[]  = { "pVAL_1",    "eVAL_5",    "eVAL_6" };
 	tpstartup();
 	trace("Exec'd file ./Test4 with XENVIRONMENT = \"%s\".", getenv("XENVIRONMENT"));
 
-	if(getenv("XENVIRONMENT") == (char *) NULL) {
+	if(getenv("XENVIRONMENT") == NULL) {
 		delete("XENVIRONMENT environment variable not set.");
 		return;
 	} else
diff --git a/xts5/Xlib17/XGetDefault/Test5.c b/xts5/Xlib17/XGetDefault/Test5.c
index e229a48..628ba7d 100644
--- a/xts5/Xlib17/XGetDefault/Test5.c
+++ b/xts5/Xlib17/XGetDefault/Test5.c
@@ -155,13 +155,13 @@ static	char	*result[]  = { "pVAL_1",    "hVAL_5",    "hVAL_6" , "hVAL_7"};
 	tpstartup();
 	trace("Exec'd file ./Test5 with HOME = \"%s\".", getenv("HOME"));
 
-	if(getenv("XENVIRONMENT") != (char *) NULL) {
+	if(getenv("XENVIRONMENT") != NULL) {
 		delete("XENVIRONMENT environment variable was set.");
 		return;
 	} else
 		CHECK;
 
-	if(getenv("HOME") == (char *) NULL) {
+	if(getenv("HOME") == NULL) {
 		delete("HOME environment variable was not set.");
 		return;
 	} else
diff --git a/xts5/Xlib17/XGetDefault/XGetDefault.m b/xts5/Xlib17/XGetDefault/XGetDefault.m
index 773d502..27835ef 100644
--- a/xts5/Xlib17/XGetDefault/XGetDefault.m
+++ b/xts5/Xlib17/XGetDefault/XGetDefault.m
@@ -350,7 +350,7 @@ char	*envp;
 		return;
 	}
 
-	if (getenv("XENVIRONMENT") != (char *)NULL) {
+	if (getenv("XENVIRONMENT") != NULL) {
 		char **newenv = environ; /* Remove XENVIRONMENT */
 	
 		trace("Removing XENVIRONMENT from environment");
diff --git a/xts5/Xlib3/XDisplayString/Test1.c b/xts5/Xlib3/XDisplayString/Test1.c
index c7f498b..119d790 100644
--- a/xts5/Xlib3/XDisplayString/Test1.c
+++ b/xts5/Xlib3/XDisplayString/Test1.c
@@ -146,7 +146,7 @@ Display		*display;
 	tpstartup();
 	trace("Exec'd file ./Test1.");
 
-	if((dispstr = getenv("DISPLAY")) == (char *) NULL) {
+	if((dispstr = getenv("DISPLAY")) == NULL) {
 		delete("Environment variable DISPLAY is not set.");
 		return;
 	} else
diff --git a/xts5/Xlib3/XDisplayString/XDisplayString.m b/xts5/Xlib3/XDisplayString/XDisplayString.m
index dd58682..8929273 100644
--- a/xts5/Xlib3/XDisplayString/XDisplayString.m
+++ b/xts5/Xlib3/XDisplayString/XDisplayString.m
@@ -194,7 +194,7 @@ char	*str;
 char	*dstr;
 char	*mstr = "DISPLAY=%s";
 
-	if((dstr = getenv("DISPLAY")) == (char *) NULL) {
+	if((dstr = getenv("DISPLAY")) == NULL) {
 		delete("DISPLAY configuration variable is not defined.");
 		return;
 	}		
diff --git a/xts5/Xlib3/XOpenDisplay/Test1.c b/xts5/Xlib3/XOpenDisplay/Test1.c
index fe97d99..e083865 100644
--- a/xts5/Xlib3/XOpenDisplay/Test1.c
+++ b/xts5/Xlib3/XOpenDisplay/Test1.c
@@ -147,7 +147,7 @@ Display		*display;
 	tpstartup();
 	trace("Exec'd file ./Test1.");
 
-	if((dispstr = getenv("DISPLAY")) == (char *) NULL) {
+	if((dispstr = getenv("DISPLAY")) == NULL) {
 		delete("Environment variable DISPLAY is not set.");
 		return;
 	} else
diff --git a/xts5/src/libproto/ClientMng.c b/xts5/src/libproto/ClientMng.c
index c22afcf..86f69d6 100644
--- a/xts5/src/libproto/ClientMng.c
+++ b/xts5/src/libproto/ClientMng.c
@@ -132,6 +132,7 @@ SOFTWARE.
 #include <config.h>
 #endif
 
+#include <stdlib.h>
 #include "XstlibInt.h"
 #include <X11/Xatom.h>
 
@@ -339,7 +340,6 @@ int	cl; /* client number */
 
     extern int  XstSendClientPrefix ();
     extern int  XstConnectDisplay ();
-    extern char *getenv ();
     extern  XID Get_Resource_Id();
 
  /* 
diff --git a/xts5/src/libproto/XlibNoXtst.c b/xts5/src/libproto/XlibNoXtst.c
index 8f408dc..d759561 100644
--- a/xts5/src/libproto/XlibNoXtst.c
+++ b/xts5/src/libproto/XlibNoXtst.c
@@ -219,7 +219,6 @@ int XstConnectDisplay (display_name, expanded_name, screen_num,
 	struct sockaddr *addr;		/* address to connect to */
         struct hostent *host_ptr;
 	int addrlen;			/* length of address */
-	extern char *getenv();
 	extern struct hostent *gethostbyname();
         int fd;				/* Network socket */
 	char numberbuf[16];
-- 
1.7.7.4



More information about the xorg-devel mailing list