xserver: Branch 'master' - 24 commits

Keith Packard keithp at kemper.freedesktop.org
Wed Dec 14 11:37:28 PST 2011


 Xext/security.c                   |    5 +-
 Xext/xres.c                       |    4 -
 dix/cursor.c                      |    2 
 dix/dispatch.c                    |    5 +-
 dix/dixutils.c                    |    4 -
 dix/registry.c                    |    5 +-
 dix/resource.c                    |    2 
 hw/kdrive/src/kdrive.c            |   15 ++----
 hw/kdrive/src/kdrive.h            |    8 ---
 hw/xfree86/common/xf86.h          |    2 
 hw/xfree86/common/xf86Config.c    |   19 ++++----
 hw/xfree86/common/xf86Configure.c |    5 +-
 hw/xfree86/common/xf86Helper.c    |   11 +---
 hw/xfree86/common/xf86Priv.h      |    6 --
 hw/xfree86/common/xf86Xinput.h    |    2 
 hw/xfree86/modes/xf86Modes.h      |    4 -
 hw/xfree86/parser/Configint.h     |    4 -
 hw/xfree86/parser/DRI.c           |    4 -
 hw/xfree86/parser/Device.c        |    4 -
 hw/xfree86/parser/Extensions.c    |    2 
 hw/xfree86/parser/Files.c         |    2 
 hw/xfree86/parser/Flags.c         |    4 -
 hw/xfree86/parser/Input.c         |    4 -
 hw/xfree86/parser/InputClass.c    |    4 -
 hw/xfree86/parser/Layout.c        |   28 ++++++------
 hw/xfree86/parser/Module.c        |    4 -
 hw/xfree86/parser/Monitor.c       |   84 +++++++++++++++++++-------------------
 hw/xfree86/parser/Pointer.c       |    8 +--
 hw/xfree86/parser/Screen.c        |   36 ++++++++--------
 hw/xfree86/parser/Vendor.c        |    6 +-
 hw/xfree86/parser/Video.c         |    6 +-
 hw/xfree86/parser/configProcs.h   |    4 -
 hw/xfree86/x86emu/debug.c         |    4 -
 hw/xfree86/x86emu/fpu.c           |   16 +++----
 hw/xfree86/x86emu/ops2.c          |    4 -
 hw/xfree86/x86emu/x86emu/debug.h  |    4 -
 include/dix.h                     |    4 -
 include/os.h                      |    6 +-
 include/registry.h                |    2 
 include/resource.h                |    2 
 os/access.c                       |   30 ++++++-------
 os/auth.c                         |    6 +-
 os/connection.c                   |    4 -
 os/io.c                           |    2 
 os/mitauth.c                      |    2 
 os/osdep.h                        |    2 
 os/osinit.c                       |    2 
 os/rpcauth.c                      |    2 
 os/utils.c                        |    4 -
 os/xdmauth.c                      |    4 -
 os/xdmcp.c                        |    6 +-
 render/filter.c                   |    3 -
 xkb/xkbActions.c                  |    9 ++--
 xkb/xkbLEDs.c                     |    6 --
 54 files changed, 203 insertions(+), 224 deletions(-)

New commits:
commit b79de3f42ff8412dcabf2f2a805cbcbd1c6907c3
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:35 2011 -0800

    xf86 parser: convert Error to a varargs macro to clear gcc format warnings
    
    Previously it always passed a format string with exactly one argument,
    using NULL when the format string needed none.   Now pass the right number
    of arguments to clear gcc warnings of 'too many arguments for format'.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/parser/Configint.h b/hw/xfree86/parser/Configint.h
index 82d7de4..3f84ff0 100644
--- a/hw/xfree86/parser/Configint.h
+++ b/hw/xfree86/parser/Configint.h
@@ -119,8 +119,8 @@ else\
 }\
 }
 
-#define Error(a,b) do { \
-			xf86parseError (a, b); CLEANUP (ptr); return NULL; \
+#define Error(...) do { \
+		xf86parseError (__VA_ARGS__); CLEANUP (ptr); return NULL; \
 		   } while (0)
 
 /* 
diff --git a/hw/xfree86/parser/DRI.c b/hw/xfree86/parser/DRI.c
index f51f6b9..77846da 100644
--- a/hw/xfree86/parser/DRI.c
+++ b/hw/xfree86/parser/DRI.c
@@ -64,7 +64,7 @@ xf86parseDRISection (void)
 		else if (token == NUMBER)
 		    ptr->dri_group = val.num;
 		else
-		    Error (GROUP_MSG, NULL);
+		    Error (GROUP_MSG);
 		break;
 	    case MODE:
 		if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER)
@@ -74,7 +74,7 @@ xf86parseDRISection (void)
 		ptr->dri_mode = val.num;
 		break;
 	    case EOF_TOKEN:
-		Error (UNEXPECTED_EOF_MSG, NULL);
+		Error (UNEXPECTED_EOF_MSG);
 		break;
 	    case COMMENT:
 		ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
diff --git a/hw/xfree86/parser/Device.c b/hw/xfree86/parser/Device.c
index d71abc6..d99dbf7 100644
--- a/hw/xfree86/parser/Device.c
+++ b/hw/xfree86/parser/Device.c
@@ -245,7 +245,7 @@ xf86parseDeviceSection (void)
 			ptr->dev_screen = val.num;
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -254,7 +254,7 @@ xf86parseDeviceSection (void)
 	}
 
 	if (!has_ident)
-		Error (NO_IDENT_MSG, NULL);
+		Error (NO_IDENT_MSG);
 
 #ifdef DEBUG
 	printf ("Device section parsed\n");
diff --git a/hw/xfree86/parser/Extensions.c b/hw/xfree86/parser/Extensions.c
index 4003b52..662f526 100644
--- a/hw/xfree86/parser/Extensions.c
+++ b/hw/xfree86/parser/Extensions.c
@@ -62,7 +62,7 @@ xf86parseExtensionsSection (void)
 		ptr->ext_option_lst = xf86parseOption(ptr->ext_option_lst);
 		break;
 	    case EOF_TOKEN:
-		Error (UNEXPECTED_EOF_MSG, NULL);
+		Error (UNEXPECTED_EOF_MSG);
 		break;
 	    case COMMENT:
 		ptr->extensions_comment =
diff --git a/hw/xfree86/parser/Files.c b/hw/xfree86/parser/Files.c
index 0c71835..a95be9e 100644
--- a/hw/xfree86/parser/Files.c
+++ b/hw/xfree86/parser/Files.c
@@ -162,7 +162,7 @@ xf86parseFilesSection (void)
 			ptr->file_xkbdir = val.str;
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		case OBSOLETE_TOKEN:
 			xf86parseError (OBSOLETE_MSG, xf86tokenString ());
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index 87fd3ed..c2a0406 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -160,7 +160,7 @@ xf86parseFlagsSection (void)
 			break;
 
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -440,7 +440,7 @@ xf86parseOption(XF86OptionPtr head)
 	int token;
 
 	if ((token = xf86getSubToken(&comment)) != STRING) {
-		xf86parseError(BAD_OPTION_MSG, NULL);
+		xf86parseError(BAD_OPTION_MSG);
 		free(comment);
 		return head;
 	}
diff --git a/hw/xfree86/parser/Input.c b/hw/xfree86/parser/Input.c
index faff0f4..e603773 100644
--- a/hw/xfree86/parser/Input.c
+++ b/hw/xfree86/parser/Input.c
@@ -114,7 +114,7 @@ xf86parseInputSection (void)
 			ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -123,7 +123,7 @@ xf86parseInputSection (void)
 	}
 
 	if (!has_ident)
-		Error (NO_IDENT_MSG, NULL);
+		Error (NO_IDENT_MSG);
 
 #ifdef DEBUG
 	printf ("InputDevice section parsed\n");
diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 2cdc912..919ae18 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -241,7 +241,7 @@ xf86parseInputClassSection(void)
                 Error(BOOL_MSG, "MatchIsTouchscreen");
             break;
         case EOF_TOKEN:
-            Error(UNEXPECTED_EOF_MSG, NULL);
+            Error(UNEXPECTED_EOF_MSG);
             break;
         default:
             Error(INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -250,7 +250,7 @@ xf86parseInputClassSection(void)
     }
 
     if (!has_ident)
-        Error(NO_IDENT_MSG, NULL);
+        Error(NO_IDENT_MSG);
 
 #ifdef DEBUG
     printf("InputClass section parsed\n");
diff --git a/hw/xfree86/parser/Layout.c b/hw/xfree86/parser/Layout.c
index 4487b0d..7dd4ebf 100644
--- a/hw/xfree86/parser/Layout.c
+++ b/hw/xfree86/parser/Layout.c
@@ -124,7 +124,7 @@ xf86parseLayoutSection (void)
 				iptr->list.next = NULL;
 				if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
 					free (iptr);
-					Error (INACTIVE_MSG, NULL);
+					Error (INACTIVE_MSG);
 				}
 				iptr->inactive_device_str = val.str;
 				ptr->lay_inactive_lst = (XF86ConfInactivePtr)
@@ -150,7 +150,7 @@ xf86parseLayoutSection (void)
 				token = xf86getSubToken(&(ptr->lay_comment));
 				if (token != STRING) {
 					free(aptr);
-					Error (SCREEN_MSG, NULL);
+					Error (SCREEN_MSG);
 				}
 				aptr->adj_screen_str = val.str;
 
@@ -178,7 +178,7 @@ xf86parseLayoutSection (void)
 					break;
 				case EOF_TOKEN:
 					free(aptr);
-					Error (UNEXPECTED_EOF_MSG, NULL);
+					Error (UNEXPECTED_EOF_MSG);
 					break;
 				default:
 					xf86unGetToken (token);
@@ -199,13 +199,13 @@ xf86parseLayoutSection (void)
 						token = xf86getSubToken(&(ptr->lay_comment));
 						if (token != NUMBER) {
 							free(aptr);
-							Error(INVALID_SCR_MSG, NULL);
+							Error(INVALID_SCR_MSG);
 						}
 						aptr->adj_y = val.num;
 					} else {
 						if (absKeyword) {
 							free(aptr);
-							Error(INVALID_SCR_MSG, NULL);
+							Error(INVALID_SCR_MSG);
 						} else
 							xf86unGetToken (token);
 					}
@@ -218,7 +218,7 @@ xf86parseLayoutSection (void)
 					token = xf86getSubToken(&(ptr->lay_comment));
 					if (token != STRING) {
 						free(aptr);
-						Error(INVALID_SCR_MSG, NULL);
+						Error(INVALID_SCR_MSG);
 					}
 					aptr->adj_refscreen = val.str;
 					if (aptr->adj_where == CONF_ADJ_RELATIVE)
@@ -226,13 +226,13 @@ xf86parseLayoutSection (void)
 						token = xf86getSubToken(&(ptr->lay_comment));
 						if (token != NUMBER) {
 							free(aptr);
-							Error(INVALID_SCR_MSG, NULL);
+							Error(INVALID_SCR_MSG);
 						}
 						aptr->adj_x = val.num;
 						token = xf86getSubToken(&(ptr->lay_comment));
 						if (token != NUMBER) {
 							free(aptr);
-							Error(INVALID_SCR_MSG, NULL);
+							Error(INVALID_SCR_MSG);
 						}
 						aptr->adj_y = val.num;
 					}
@@ -244,21 +244,21 @@ xf86parseLayoutSection (void)
 					/* bottom */
 					if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
 						free(aptr);
-						Error (SCREEN_MSG, NULL);
+						Error (SCREEN_MSG);
 					}
 					aptr->adj_bottom_str = val.str;
 
 					/* left */
 					if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
 						free(aptr);
-						Error (SCREEN_MSG, NULL);
+						Error (SCREEN_MSG);
 					}
 					aptr->adj_left_str = val.str;
 
 					/* right */
 					if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
 						free(aptr);
-						Error (SCREEN_MSG, NULL);
+						Error (SCREEN_MSG);
 					}
 					aptr->adj_right_str = val.str;
 
@@ -276,7 +276,7 @@ xf86parseLayoutSection (void)
 				iptr->iref_option_lst = NULL;
 				if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
 					free(iptr);
-					Error (INPUTDEV_MSG, NULL);
+					Error (INPUTDEV_MSG);
 				}
 				iptr->iref_inputdev_str = val.str;
 				while ((token = xf86getSubToken (&(ptr->lay_comment))) == STRING)
@@ -293,7 +293,7 @@ xf86parseLayoutSection (void)
 			ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst);
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -302,7 +302,7 @@ xf86parseLayoutSection (void)
 	}
 
 	if (!has_ident)
-		Error (NO_IDENT_MSG, NULL);
+		Error (NO_IDENT_MSG);
 
 #ifdef DEBUG
 	printf ("Layout section parsed\n");
diff --git a/hw/xfree86/parser/Module.c b/hw/xfree86/parser/Module.c
index ca323fc..3c4cefc 100644
--- a/hw/xfree86/parser/Module.c
+++ b/hw/xfree86/parser/Module.c
@@ -107,7 +107,7 @@ xf86parseModuleSubSection (XF86LoadPtr head, char *name)
 			ptr->load_opt = xf86parseOption(ptr->load_opt);
 			break;
 		case EOF_TOKEN:
-			xf86parseError (UNEXPECTED_EOF_MSG, NULL);
+			xf86parseError (UNEXPECTED_EOF_MSG);
 			free(ptr);
 			return NULL;
 		default:
@@ -163,7 +163,7 @@ xf86parseModuleSection (void)
 				xf86parseModuleSubSection (ptr->mod_load_lst, val.str);
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
diff --git a/hw/xfree86/parser/Monitor.c b/hw/xfree86/parser/Monitor.c
index 970406d..52c5500 100644
--- a/hw/xfree86/parser/Monitor.c
+++ b/hw/xfree86/parser/Monitor.c
@@ -145,52 +145,52 @@ xf86parseModeLine (void)
 
 	/* Identifier */
 	if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
-		Error ("ModeLine identifier expected", NULL);
+		Error ("ModeLine identifier expected");
 	ptr->ml_identifier = val.str;
 
 	/* DotClock */
 	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-		Error ("ModeLine dotclock expected", NULL);
+		Error ("ModeLine dotclock expected");
 	ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
 
 	/* HDisplay */
 	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-		Error ("ModeLine Hdisplay expected", NULL);
+		Error ("ModeLine Hdisplay expected");
 	ptr->ml_hdisplay = val.num;
 
 	/* HSyncStart */
 	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-		Error ("ModeLine HSyncStart expected", NULL);
+		Error ("ModeLine HSyncStart expected");
 	ptr->ml_hsyncstart = val.num;
 
 	/* HSyncEnd */
 	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-		Error ("ModeLine HSyncEnd expected", NULL);
+		Error ("ModeLine HSyncEnd expected");
 	ptr->ml_hsyncend = val.num;
 
 	/* HTotal */
 	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-		Error ("ModeLine HTotal expected", NULL);
+		Error ("ModeLine HTotal expected");
 	ptr->ml_htotal = val.num;
 
 	/* VDisplay */
 	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-		Error ("ModeLine Vdisplay expected", NULL);
+		Error ("ModeLine Vdisplay expected");
 	ptr->ml_vdisplay = val.num;
 
 	/* VSyncStart */
 	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-		Error ("ModeLine VSyncStart expected", NULL);
+		Error ("ModeLine VSyncStart expected");
 	ptr->ml_vsyncstart = val.num;
 
 	/* VSyncEnd */
 	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-		Error ("ModeLine VSyncEnd expected", NULL);
+		Error ("ModeLine VSyncEnd expected");
 	ptr->ml_vsyncend = val.num;
 
 	/* VTotal */
 	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-		Error ("ModeLine VTotal expected", NULL);
+		Error ("ModeLine VTotal expected");
 	ptr->ml_vtotal = val.num;
 
 	token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
@@ -247,7 +247,7 @@ xf86parseModeLine (void)
 			ptr->ml_flags |= XF86CONF_VSCAN;
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -271,7 +271,7 @@ xf86parseVerboseMode (void)
 	parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)
 
 		if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
-		Error ("Mode name expected", NULL);
+		Error ("Mode name expected");
 	ptr->ml_identifier = val.str;
 	while ((token = xf86getToken (ModeTab)) != ENDMODE)
 	{
@@ -290,44 +290,44 @@ xf86parseVerboseMode (void)
 			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
 				ptr->ml_hdisplay = val.num;
 			else
-				Error ("Horizontal display expected", NULL);
+				Error ("Horizontal display expected");
 
 			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
 				ptr->ml_hsyncstart = val.num;
 			else
-				Error ("Horizontal sync start expected", NULL);
+				Error ("Horizontal sync start expected");
 
 			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
 				ptr->ml_hsyncend = val.num;
 			else
-				Error ("Horizontal sync end expected", NULL);
+				Error ("Horizontal sync end expected");
 
 			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
 				ptr->ml_htotal = val.num;
 			else
-				Error ("Horizontal total expected", NULL);
+				Error ("Horizontal total expected");
 			had_htimings = 1;
 			break;
 		case VTIMINGS:
 			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
 				ptr->ml_vdisplay = val.num;
 			else
-				Error ("Vertical display expected", NULL);
+				Error ("Vertical display expected");
 
 			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
 				ptr->ml_vsyncstart = val.num;
 			else
-				Error ("Vertical sync start expected", NULL);
+				Error ("Vertical sync start expected");
 
 			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
 				ptr->ml_vsyncend = val.num;
 			else
-				Error ("Vertical sync end expected", NULL);
+				Error ("Vertical sync end expected");
 
 			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
 				ptr->ml_vtotal = val.num;
 			else
-				Error ("Vertical total expected", NULL);
+				Error ("Vertical total expected");
 			had_vtimings = 1;
 			break;
 		case FLAGS:
@@ -367,10 +367,10 @@ xf86parseVerboseMode (void)
 					ptr->ml_flags |= XF86CONF_DBLSCAN;
 					break;
 				case EOF_TOKEN:
-					Error (UNEXPECTED_EOF_MSG, NULL);
+					Error (UNEXPECTED_EOF_MSG);
 					break;
 				default:
-					Error ("Unknown flag string", NULL);
+					Error ("Unknown flag string");
 					break;
 				}
 				token = xf86getSubToken (&(ptr->ml_comment));
@@ -379,29 +379,29 @@ xf86parseVerboseMode (void)
 			break;
 		case HSKEW:
 			if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-				Error ("Horizontal skew expected", NULL);
+				Error ("Horizontal skew expected");
 			ptr->ml_flags |= XF86CONF_HSKEW;
 			ptr->ml_hskew = val.num;
 			break;
 		case VSCAN:
 			if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
-				Error ("Vertical scan count expected", NULL);
+				Error ("Vertical scan count expected");
 			ptr->ml_flags |= XF86CONF_VSCAN;
 			ptr->ml_vscan = val.num;
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
-			Error ("Unexepcted token in verbose \"Mode\" entry\n", NULL);
+			Error ("Unexepcted token in verbose \"Mode\" entry\n");
 		}
 	}
 	if (!had_dotclock)
-		Error ("the dotclock is missing", NULL);
+		Error ("the dotclock is missing");
 	if (!had_htimings)
-		Error ("the horizontal timings are missing", NULL);
+		Error ("the horizontal timings are missing");
 	if (!had_vtimings)
-		Error ("the vertical timings are missing", NULL);
+		Error ("the vertical timings are missing");
 
 #ifdef DEBUG
 	printf ("Verbose Mode parsed\n");
@@ -455,19 +455,19 @@ xf86parseMonitorSection (void)
 			break;
 		case DISPLAYSIZE:
 			if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
-				Error (DISPLAYSIZE_MSG, NULL);
+				Error (DISPLAYSIZE_MSG);
 			ptr->mon_width = val.realnum;
 			if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
-				Error (DISPLAYSIZE_MSG, NULL);
+				Error (DISPLAYSIZE_MSG);
 			ptr->mon_height = val.realnum;
 			break;
 
 		case HORIZSYNC:
 			if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
-				Error (HORIZSYNC_MSG, NULL);
+				Error (HORIZSYNC_MSG);
 			do {
 				if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
-					Error ("Sorry. Too many horizontal sync intervals.", NULL);
+					Error ("Sorry. Too many horizontal sync intervals.");
 				ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
 				switch (token = xf86getSubToken (&(ptr->mon_comment)))
 				{
@@ -478,7 +478,7 @@ xf86parseMonitorSection (void)
 					case DASH:
 						if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
 						    (float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo)
-							Error (HORIZSYNC_MSG, NULL);
+							Error (HORIZSYNC_MSG);
 						ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
 						if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
 							break;
@@ -501,7 +501,7 @@ HorizDone:
 
 		case VERTREFRESH:
 			if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
-				Error (VERTREFRESH_MSG, NULL);
+				Error (VERTREFRESH_MSG);
 			do {
 				ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum;
 				switch (token = xf86getSubToken (&(ptr->mon_comment)))
@@ -513,7 +513,7 @@ HorizDone:
 					case DASH:
 						if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
 						    (float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
-							Error (VERTREFRESH_MSG, NULL);
+							Error (VERTREFRESH_MSG);
 						ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
 						if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
 							break;
@@ -529,7 +529,7 @@ HorizDone:
 						goto VertDone;
 				}
 				if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH)
-					Error ("Sorry. Too many vertical refresh intervals.", NULL);
+					Error ("Sorry. Too many vertical refresh intervals.");
 				ptr->mon_n_vrefresh++;
 			} while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
 VertDone:
@@ -539,7 +539,7 @@ VertDone:
 		case GAMMA:
 			if( xf86getSubToken (&(ptr->mon_comment)) != NUMBER )
 			{
-				Error (INVALID_GAMMA_MSG, NULL);
+				Error (INVALID_GAMMA_MSG);
 			}
 			else
 			{
@@ -554,7 +554,7 @@ VertDone:
 					}
 					else
 					{
-						Error (INVALID_GAMMA_MSG, NULL);
+						Error (INVALID_GAMMA_MSG);
 					}
 				}
 				else
@@ -583,7 +583,7 @@ VertDone:
 			}
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -594,7 +594,7 @@ VertDone:
 	}
 
 	if (!has_ident)
-		Error (NO_IDENT_MSG, NULL);
+		Error (NO_IDENT_MSG);
 
 #ifdef DEBUG
 	printf ("Monitor section parsed\n");
@@ -644,7 +644,7 @@ xf86parseModesSection (void)
 	}
 
 	if (!has_ident)
-		Error (NO_IDENT_MSG, NULL);
+		Error (NO_IDENT_MSG);
 
 #ifdef DEBUG
 	printf ("Modes section parsed\n");
diff --git a/hw/xfree86/parser/Pointer.c b/hw/xfree86/parser/Pointer.c
index e8ad290..4edbf74 100644
--- a/hw/xfree86/parser/Pointer.c
+++ b/hw/xfree86/parser/Pointer.c
@@ -184,10 +184,10 @@ xf86parsePointerSection (void)
 			switch (xf86getToken(ZMapTab)) {
 			case NUMBER:
 				if (val.num < 0)
-					Error (ZAXISMAPPING_MSG, NULL);
+					Error (ZAXISMAPPING_MSG);
 				val1 = val.num;
 				if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
-					Error (ZAXISMAPPING_MSG, NULL);
+					Error (ZAXISMAPPING_MSG);
 				}
 				if (asprintf(&s, "%lu %u", val1, val.num) == -1)
 				    s = NULL;
@@ -199,7 +199,7 @@ xf86parsePointerSection (void)
 				s = strdup("y");
 				break;
 			default:
-				Error (ZAXISMAPPING_MSG, NULL);
+				Error (ZAXISMAPPING_MSG);
 				break;
 			}
 			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
@@ -209,7 +209,7 @@ xf86parsePointerSection (void)
 		case ALWAYSCORE:
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c
index dd2319d..2ca2c57 100644
--- a/hw/xfree86/parser/Screen.c
+++ b/hw/xfree86/parser/Screen.c
@@ -101,18 +101,18 @@ xf86parseDisplaySubSection (void)
 			break;
 		case VIEWPORT:
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (VIEWPORT_MSG, NULL);
+				Error (VIEWPORT_MSG);
 			ptr->disp_frameX0 = val.num;
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (VIEWPORT_MSG, NULL);
+				Error (VIEWPORT_MSG);
 			ptr->disp_frameY0 = val.num;
 			break;
 		case VIRTUAL:
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (VIRTUAL_MSG, NULL);
+				Error (VIRTUAL_MSG);
 			ptr->disp_virtualX = val.num;
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (VIRTUAL_MSG, NULL);
+				Error (VIRTUAL_MSG);
 			ptr->disp_virtualY = val.num;
 			break;
 		case DEPTH:
@@ -132,35 +132,35 @@ xf86parseDisplaySubSection (void)
 			break;
 		case WEIGHT:
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (WEIGHT_MSG, NULL);
+				Error (WEIGHT_MSG);
 			ptr->disp_weight.red = val.num;
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (WEIGHT_MSG, NULL);
+				Error (WEIGHT_MSG);
 			ptr->disp_weight.green = val.num;
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (WEIGHT_MSG, NULL);
+				Error (WEIGHT_MSG);
 			ptr->disp_weight.blue = val.num;
 			break;
 		case BLACK_TOK:
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (BLACK_MSG, NULL);
+				Error (BLACK_MSG);
 			ptr->disp_black.red = val.num;
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (BLACK_MSG, NULL);
+				Error (BLACK_MSG);
 			ptr->disp_black.green = val.num;
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (BLACK_MSG, NULL);
+				Error (BLACK_MSG);
 			ptr->disp_black.blue = val.num;
 			break;
 		case WHITE_TOK:
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (WHITE_MSG, NULL);
+				Error (WHITE_MSG);
 			ptr->disp_white.red = val.num;
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (WHITE_MSG, NULL);
+				Error (WHITE_MSG);
 			ptr->disp_white.green = val.num;
 			if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
-				Error (WHITE_MSG, NULL);
+				Error (WHITE_MSG);
 			ptr->disp_white.blue = val.num;
 			break;
 		case MODES:
@@ -183,7 +183,7 @@ xf86parseDisplaySubSection (void)
 			break;
 			
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -302,10 +302,10 @@ xf86parseScreenSection (void)
 			break;
 		case VIRTUAL:
 			if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
-				Error (VIRTUAL_MSG, NULL);
+				Error (VIRTUAL_MSG);
 			ptr->scrn_virtualX = val.num;
 			if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
-				Error (VIRTUAL_MSG, NULL);
+				Error (VIRTUAL_MSG);
 			ptr->scrn_virtualY = val.num;
 			break;
 		case OPTION:
@@ -321,7 +321,7 @@ xf86parseScreenSection (void)
 			}
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -330,7 +330,7 @@ xf86parseScreenSection (void)
 	}
 
 	if (!has_ident && !has_driver)
-		Error (NO_IDENT_MSG, NULL);
+		Error (NO_IDENT_MSG);
 
 #ifdef DEBUG
 	printf ("Screen section parsed\n");
diff --git a/hw/xfree86/parser/Vendor.c b/hw/xfree86/parser/Vendor.c
index dce3f1c..d61f0a0 100644
--- a/hw/xfree86/parser/Vendor.c
+++ b/hw/xfree86/parser/Vendor.c
@@ -102,7 +102,7 @@ xf86parseVendorSubSection (void)
 			break;
 
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -164,7 +164,7 @@ xf86parseVendorSection (void)
 			}
 			break;
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -174,7 +174,7 @@ xf86parseVendorSection (void)
 	}
 
 	if (!has_ident)
-		Error (NO_IDENT_MSG, NULL);
+		Error (NO_IDENT_MSG);
 
 #ifdef DEBUG
 	printf ("Vendor section parsed\n");
diff --git a/hw/xfree86/parser/Video.c b/hw/xfree86/parser/Video.c
index 3774387..19a5418 100644
--- a/hw/xfree86/parser/Video.c
+++ b/hw/xfree86/parser/Video.c
@@ -117,7 +117,7 @@ xf86parseVideoPortSubSection (void)
 			break;
 
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -205,7 +205,7 @@ xf86parseVideoAdaptorSection (void)
 			break;
 
 		case EOF_TOKEN:
-			Error (UNEXPECTED_EOF_MSG, NULL);
+			Error (UNEXPECTED_EOF_MSG);
 			break;
 		default:
 			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -214,7 +214,7 @@ xf86parseVideoAdaptorSection (void)
 	}
 
 	if (!has_ident)
-		Error (NO_IDENT_MSG, NULL);
+		Error (NO_IDENT_MSG);
 
 #ifdef DEBUG
 	printf ("VideoAdaptor section parsed\n");
commit 7801b3dcd6501e3de93a6d2cee93b2593806e922
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:35 2011 -0800

    Add some printf format attributes suggested by gcc
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/security.c b/Xext/security.c
index 63892aa..df5bd58 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -97,7 +97,7 @@ static const Mask SecurityClientMask = DixGetAttrAccess;
  *	Writes the message to the log file if security logging is on.
  */
 
-static void
+static void _X_ATTRIBUTE_PRINTF(1,2)
 SecurityAudit(const char *format, ...)
 {
     va_list args;
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index f216d5e..b711f05 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -232,7 +232,7 @@ extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
 extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen);
 extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
 extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
-		     const char *format, va_list args);
+		     const char *format, va_list args) _X_ATTRIBUTE_PRINTF(4,0);
 extern _X_EXPORT void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
 		    const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
 extern _X_EXPORT void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 94d2b15..569695c 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -552,7 +552,7 @@ xf86DriverlistFromCompile(void)
  *      Print a READABLE ErrorMessage!!!  All information that is 
  *      available is printed.
  */
-static void
+static void _X_ATTRIBUTE_PRINTF(1,2)
 xf86ConfigError(const char *msg, ...)
 {
     va_list ap;
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 909fb57..7d96fac 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -173,7 +173,7 @@ extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev,
 				       MessageType type,
 				       int verb,
 				       const char *format,
-				       va_list args);
+				       va_list args) _X_ATTRIBUTE_PRINTF(4,0);
 
 /* xf86Option.c */
 extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h
index 114cdfe..d67acc6 100644
--- a/hw/xfree86/parser/configProcs.h
+++ b/hw/xfree86/parser/configProcs.h
@@ -95,8 +95,8 @@ int xf86getSubToken(char **comment);
 int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab);
 void xf86unGetToken(int token);
 char *xf86tokenString(void);
-void xf86parseError(const char *format, ...);
-void xf86validationError(const char *format, ...);
+void xf86parseError(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,2);
+void xf86validationError(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,2);
 void xf86setSection(const char *section);
 int xf86getStringToken(xf86ConfigSymTabRec *tab);
 /* write.c */
commit f68df9dfd2c7ca03c24aaa0a895b7191ecb81e85
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    xf86Priv.h: Add some noreturn attributes suggested by gcc
    
    Both functions call exit() at the end and have no other return path.
    Also correct comment/heading to reflect commit 6450f6ca7ee0 moving
    DoShowOptions into xf86Configure.c.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 8c69859..e0b1809 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -125,10 +125,8 @@ extern _X_EXPORT const DisplayModeRec xf86DefaultModes[];
 extern _X_EXPORT const int xf86NumDefaultModes;
 
 /* xf86Configure.c */
-extern _X_EXPORT void DoConfigure(void);
-
-/* xf86ShowOpts.c */
-extern _X_EXPORT void DoShowOptions(void);
+extern _X_EXPORT void DoConfigure(void) _X_NORETURN;
+extern _X_EXPORT void DoShowOptions(void) _X_NORETURN;
 
 /* xf86Events.c */
 
commit 3823eedf3c124d3a20360480ba349bea72de3069
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    Remove duplicate declarations of KdAdd*Driver in kdrive.h
    
    Clears gcc warnings in every file that includes kdrive.h:
    kdrive.h:507:1: warning: redundant redeclaration of 'KdAddPointerDriver'
    kdrive.h:225:6: note: previous declaration of 'KdAddPointerDriver' was here
    kdrive.h:510:1: warning: redundant redeclaration of 'KdAddKeyboardDriver'
    kdrive.h:284:6: note: previous declaration of 'KdAddKeyboardDriver' was here
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index be884ab..cda965d 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -503,12 +503,6 @@ KdInitInput(void);
 void
 KdCloseInput(void);
 
-void
-KdAddPointerDriver(KdPointerDriver *);
-
-void
-KdAddKeyboardDriver(KdKeyboardDriver *);
-
 Bool
 KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure);
 
commit 471e5373b6f87336dac3b9de9b3852f63a2b10dc
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    Remove duplicate declaration of xf86ValidateModesFlags in xf86Modes.h
    
    Clears gcc warning in every file that includes xf86Modes.h:
    xf86Modes.h:102:1: warning: redundant redeclaration of 'xf86ValidateModesFlags'
    xf86Modes.h:72:1: note: previous declaration of 'xf86ValidateModesFlags' was here
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h
index c72a935..89ec0d8 100644
--- a/hw/xfree86/modes/xf86Modes.h
+++ b/hw/xfree86/modes/xf86Modes.h
@@ -99,10 +99,6 @@ extern _X_EXPORT DisplayModePtr
 xf86PruneDuplicateModes(DisplayModePtr modes);
 
 extern _X_EXPORT void
-xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
-		       int flags);
-
-extern _X_EXPORT void
 xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
 
 extern _X_EXPORT DisplayModePtr
commit 41dd7cf673e47ab74c5065b8dbf268b2e5facb64
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    _XkbFilterDeviceBtn: move variable declarations to match usage scope
    
    The main body of this function is an if { } else if { } pair of blocks.
    Previously there was int button at the top level scope which is used
    only in the first block, and a redeclaration of int button inside the
    second block.   Since there's no overlap in the code paths for the
    two uses of button, move the one from the outer block into the first
    block to help the programmer more quickly determine they are unrelated
    usages, and to silence the gcc warning of:
    
    xkbActions.c: In function '_XkbFilterDeviceBtn':
    xkbActions.c:999:6: warning: declaration of 'button' shadows a previous local
    xkbActions.c:955:6: warning: shadowed declaration is here
    
    For consistency, move DeviceIntPtr dev declarations as well that are
    used in the same way.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 1e94d26..33864e1 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -951,13 +951,13 @@ _XkbFilterDeviceBtn(	XkbSrvInfoPtr	xkbi,
 			unsigned	keycode,
 			XkbAction *	pAction)
 {
-DeviceIntPtr	dev;
-int		button;
-
     if (xkbi->device == inputInfo.keyboard)
         return 0;
 
     if (filter->keycode==0) {		/* initial press */
+	DeviceIntPtr	dev;
+	int		button;
+
 	_XkbLookupButtonDevice(&dev, pAction->devbtn.device, serverClient,
 			       DixUnknownAccess, &button);
 	if (!dev || !dev->public.on)
@@ -996,7 +996,8 @@ int		button;
 	}
     }
     else if (filter->keycode==keycode) {
-	int	button;
+	DeviceIntPtr	dev;
+	int		button;
 
 	filter->active= 0;
 	_XkbLookupButtonDevice(&dev, filter->upAction.devbtn.device,
commit d8eb9b5faa2d2c9350bdaffef8749a9cac3c87b8
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    XkbFindSrvLedInfo: remove extraneous name-clashing sli variable
    
    Variable is already defined outside the outer if statement, and
    there's no need to redefine inside the if statement.
    
    No point in setting sli before if (dev->kbdfeed->xkb_sli==NULL)
    check - if check is true, we immediately set it, if check is false,
    we immediately return without further reference or use of it.
    
    The one thing we do with it inside the inner if statement is store
    an allocation in it for a brief moment before writing to the final
    destination, which is immediately returned to the caller.
    
    In short, there's no benefit to the variable at all in this block,
    it just gives the optimizer more code to figure out how to omit.
    
    Fixes gcc warning:
    xkbLEDs.c: In function 'XkbFindSrvLedInfo':
    xkbLEDs.c:683:19: warning: declaration of 'sli' shadows a previous local
    xkbLEDs.c:679:18: warning: shadowed declaration is here
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index 515e9b7..24fcd3b 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -680,11 +680,9 @@ XkbSrvLedInfoPtr	sli;
 
     /* optimization to check for most common case */
     if (((class==XkbDfltXIClass)&&(id==XkbDfltXIId))&&(dev->kbdfeed)) {
-	XkbSrvLedInfoPtr	sli;
-	sli= dev->kbdfeed->xkb_sli;
 	if (dev->kbdfeed->xkb_sli==NULL) {
-	    sli= XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,needed_parts);
-	    dev->kbdfeed->xkb_sli= sli;
+	    dev->kbdfeed->xkb_sli=
+		XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,needed_parts);
 	}
 	return dev->kbdfeed->xkb_sli;
     }
commit 9edfa47bd58cd318d57d0f114714fd146be35a79
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    KdParseFindNext: Constify delim argument
    
    It's only used as input to strchr to find the delimiters, never
    written to.
    
    Clears a bunch of gcc warnings of the form:
    kdrive.c:323:2: warning: passing argument 2 of 'KdParseFindNext' discards qualifiers from pointer target type
    kdrive.c:261:1: note: expected 'char *' but argument is of type 'const char *'
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 2c64940..f6cc351 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -253,7 +253,7 @@ Bool	kdDumbDriver;
 Bool	kdSoftCursor;
 
 char *
-KdParseFindNext (char *cur, char *delim, char *save, char *last)
+KdParseFindNext (char *cur, const char *delim, char *save, char *last)
 {
     while (*cur && !strchr (delim, *cur))
     {
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 9ac5a19..be884ab 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -424,7 +424,7 @@ KdKeyboardInfo *
 KdParseKeyboard (char *arg);
 
 char *
-KdParseFindNext (char *cur, char *delim, char *save, char *last);
+KdParseFindNext (char *cur, const char *delim, char *save, char *last);
 
 void
 KdParseRgba (char *rgba);
commit ff64ad6c74a3e14ca34bacb8866bdbd2262bddff
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    Convert KdDoSwitchCmd to use asprintf instead of malloc/strcat/etc.
    
    Also fix the reason argument to be const char * to clear several gcc
    warnings of:
    kdrive.c:151:2: warning: passing argument 1 of 'KdDoSwitchCmd' discards qualifiers from pointer target type
    kdrive.c:116:1: note: expected 'char *' but argument is of type 'const char *'
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 8dd039e..2c64940 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -113,19 +113,14 @@ KdDisableScreen (ScreenPtr pScreen)
 }
 
 static void
-KdDoSwitchCmd (char *reason)
+KdDoSwitchCmd (const char *reason)
 {
     if (kdSwitchCmd)
     {
-	char    *command = malloc(strlen (kdSwitchCmd) +
-				   1 +
-				   strlen (reason) +
-				   1);
-	if (!command)
+	char    *command;
+
+	if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1)
 	    return;
-	strcpy (command, kdSwitchCmd);
-	strcat (command, " ");
-	strcat (command, reason);
 	system (command);
 	free(command);
     }
commit 5bc590bde23ce1c57015b1d9e1cc63189c37448e
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    DoShowOptions: preserve constness of options list as we walk it
    
    Since all we do with the option list is walk down the list printing
    the names, there's no need to cast away its constness.
    
    Clears gcc warning:
    xf86Configure.c: In function 'DoShowOptions':
    xf86Configure.c:781:4: warning: cast discards qualifiers from pointer target type
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 24f367e..994d46f 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -778,7 +778,8 @@ void DoShowOptions (void) {
 	free(vlist);
 	for (i = 0; i < xf86NumDrivers; i++) {
 		if (xf86DriverList[i]->AvailableOptions) {
-			OptionInfoPtr pOption = (OptionInfoPtr)(*xf86DriverList[i]->AvailableOptions)(0,0);
+			const OptionInfoRec *pOption =
+			    (*xf86DriverList[i]->AvailableOptions)(0,0);
 			if (! pOption) {
 				ErrorF ("(EE) Couldn't read option table for %s driver\n",
 					xf86DriverList[i]->driverName
@@ -790,7 +791,7 @@ void DoShowOptions (void) {
 			initData = LoaderSymbol (pSymbol);
 			if (initData) {
 				XF86ModuleVersionInfo *vers = initData->vers;
-				OptionInfoPtr p;
+				const OptionInfoRec *p;
 				ErrorF ("Driver[%d]:%s[%s] {\n",
 					i,xf86DriverList[i]->driverName,vers->vendor
 				);
commit 71efd868282d47a6db405a16de18ac322926962b
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    x86emu: constify debug strings
    
    Strings are all pointers to literal constants, just used as input
    to printf calls when debugging is enabled.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/x86emu/debug.c b/hw/xfree86/x86emu/debug.c
index 04d0741..6dea9c7 100644
--- a/hw/xfree86/x86emu/debug.c
+++ b/hw/xfree86/x86emu/debug.c
@@ -163,13 +163,13 @@ void x86emu_inc_decoded_inst_len (int x)
 	M.x86.enc_pos += x;
 }
 
-void x86emu_decode_printf (char *x)
+void x86emu_decode_printf (const char *x)
 {
 	sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",x);
 	M.x86.enc_str_pos += strlen(x);
 }
 
-void x86emu_decode_printf2 (char *x, int y)
+void x86emu_decode_printf2 (const char *x, int y)
 {
 	char temp[100];
 	snprintf(temp,sizeof(temp),x,y);
diff --git a/hw/xfree86/x86emu/fpu.c b/hw/xfree86/x86emu/fpu.c
index b72de1e..fbc602d 100644
--- a/hw/xfree86/x86emu/fpu.c
+++ b/hw/xfree86/x86emu/fpu.c
@@ -52,7 +52,7 @@ void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
 
 #ifdef DEBUG
 
-static char *x86emu_fpu_op_d9_tab[] = {
+static const char *x86emu_fpu_op_d9_tab[] = {
     "FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ",
     "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
 
@@ -63,7 +63,7 @@ static char *x86emu_fpu_op_d9_tab[] = {
     "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
 };
 
-static char *x86emu_fpu_op_d9_tab1[] = {
+static const char *x86emu_fpu_op_d9_tab1[] = {
     "FLD\t", "FLD\t", "FLD\t", "FLD\t",
     "FLD\t", "FLD\t", "FLD\t", "FLD\t",
 
@@ -299,7 +299,7 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
 
 #ifdef DEBUG
 
-char *x86emu_fpu_op_da_tab[] = {
+static const char *x86emu_fpu_op_da_tab[] = {
     "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
     "FICOMP\tDWORD PTR ",
     "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
@@ -392,7 +392,7 @@ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
 
 #ifdef DEBUG
 
-char *x86emu_fpu_op_db_tab[] = {
+static const char *x86emu_fpu_op_db_tab[] = {
     "FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ",
     "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
 
@@ -513,7 +513,7 @@ void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
 }
 
 #ifdef DEBUG
-char *x86emu_fpu_op_dc_tab[] = {
+static const char *x86emu_fpu_op_dc_tab[] = {
     "FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ",
     "FCOMP\tQWORD PTR ",
     "FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ",
@@ -631,7 +631,7 @@ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
 
 #ifdef DEBUG
 
-static char *x86emu_fpu_op_dd_tab[] = {
+static const char *x86emu_fpu_op_dd_tab[] = {
     "FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ",
     "FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t",
 
@@ -734,7 +734,7 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
 
 #ifdef DEBUG
 
-static char *x86emu_fpu_op_de_tab[] =
+static const char *x86emu_fpu_op_de_tab[] =
 {
     "FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ",
     "FICOMP\tWORD PTR ",
@@ -856,7 +856,7 @@ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
 
 #ifdef DEBUG
 
-static char *x86emu_fpu_op_df_tab[] = {
+static const char *x86emu_fpu_op_df_tab[] = {
     /* mod == 00 */
     "FILD\tWORD PTR ", "ESC_DF\t39\n", "FIST\tWORD PTR ", "FISTP\tWORD PTR ",
     "FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ",
diff --git a/hw/xfree86/x86emu/ops2.c b/hw/xfree86/x86emu/ops2.c
index 39bd041..501d5fc 100644
--- a/hw/xfree86/x86emu/ops2.c
+++ b/hw/xfree86/x86emu/ops2.c
@@ -110,7 +110,7 @@ Handles opcode 0x0f,0x80-0x8F
 static void x86emuOp2_long_jump(u8 op2)
 {
     s32 target;
-    char *name = NULL;
+    const char *name = NULL;
     int cond = 0;
 
     /* conditional jump to word offset. */
@@ -204,7 +204,7 @@ static void x86emuOp2_set_byte(u8 op2)
     int mod, rl, rh;
     uint destoffset;
     u8  *destreg;
-    char *name = NULL;
+    const char *name = NULL;
     int cond = 0;
 
     START_OF_INSTR();
diff --git a/hw/xfree86/x86emu/x86emu/debug.h b/hw/xfree86/x86emu/x86emu/debug.h
index 47aacb6..5f78d05 100644
--- a/hw/xfree86/x86emu/x86emu/debug.h
+++ b/hw/xfree86/x86emu/x86emu/debug.h
@@ -189,8 +189,8 @@ extern "C" {            			/* Use "C" linkage when in C++ mode */
 #endif
 
 extern void x86emu_inc_decoded_inst_len (int x);
-extern void x86emu_decode_printf (char *x);
-extern void x86emu_decode_printf2 (char *x, int y);
+extern void x86emu_decode_printf (const char *x);
+extern void x86emu_decode_printf2 (const char *x, int y);
 extern void x86emu_just_disassemble (void);
 extern void x86emu_single_step (void);
 extern void x86emu_end_instr (void);
commit d5a5eece670dee963765eab1431c21525c16d9ee
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:34 2011 -0800

    CompareISOLatin1Lowered: constify arguments
    
    Allows callers to avoid deconstifying arguments when calling, fixing
    gcc warning:
    
    filter.c: In function 'PictureGetFilterId':
    filter.c:59:2: warning: cast discards qualifiers from pointer target type
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/dixutils.c b/dix/dixutils.c
index 1e31346..00bbde6 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -167,8 +167,8 @@ ISOLatin1ToLower (unsigned char source)
 
 
 int
-CompareISOLatin1Lowered(unsigned char *s1, int s1len, 
-			unsigned char *s2, int s2len)
+CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
+			const unsigned char *s2, int s2len)
 {
     unsigned char   c1, c2;
     
diff --git a/include/dix.h b/include/dix.h
index cfbfa1f..2d8d315 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -175,9 +175,9 @@ extern _X_HIDDEN Bool CreateConnectionBlock(void);
 /* dixutils.c */
 
 extern _X_EXPORT int CompareISOLatin1Lowered(
-    unsigned char * /*a*/,
+    const unsigned char * /*a*/,
     int alen,
-    unsigned char * /*b*/,
+    const unsigned char * /*b*/,
     int blen);
 
 extern _X_EXPORT int dixLookupWindow(
diff --git a/render/filter.c b/render/filter.c
index 0cbd47b..c513ee8 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -56,7 +56,8 @@ PictureGetFilterId (const char *filter, int len, Bool makeit)
     if (len < 0)
 	len = strlen (filter);
     for (i = 0; i < nfilterNames; i++)
-	if (!CompareISOLatin1Lowered ((unsigned char *) filterNames[i], -1, (unsigned char *) filter, len))
+	if (!CompareISOLatin1Lowered ((const unsigned char *) filterNames[i], -1,
+				      (const unsigned char *) filter, len))
 	    return i;
     if (!makeit)
 	return -1;
commit 83ac9502ea9f1dedf3a8002745668af16bb1f2af
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:33 2011 -0800

    xdmcp.c: fix three small const warnings
    
    xdmcp.c:63:36: warning: initialization discards qualifiers from pointer target type
    
    xdmcp.c: In function 'XdmcpRegisterConnection':
    xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type
    xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type
    xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type
    
    xdmcp.c: In function 'get_mcast_options':
    xdmcp.c:1596:21: warning: initialization discards qualifiers from pointer target type
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/xdmcp.c b/os/xdmcp.c
index 4644071..77f02da 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -60,7 +60,7 @@
 #define X_INCLUDE_NETDB_H
 #include <X11/Xos_r.h>
 
-static char *defaultDisplayClass = COMPILEDDISPLAYCLASS;
+static const char *defaultDisplayClass = COMPILEDDISPLAYCLASS;
 
 static int		    xdmcpSocket, sessionSocket;
 static xdmcp_states	    state;
@@ -479,7 +479,7 @@ XdmcpRegisterConnection (
 	    if (SOCKADDR_FAMILY(FromAddress) == AF_INET6) {
 		fromAddr = &((struct sockaddr_in6 *)&FromAddress)->sin6_addr;
 	    } else if ((SOCKADDR_FAMILY(FromAddress) == AF_INET) &&
-	      IN6_IS_ADDR_V4MAPPED((struct in6_addr *) address)) {
+	      IN6_IS_ADDR_V4MAPPED((const struct in6_addr *) address)) {
 		fromAddr = &((struct sockaddr_in *)&FromAddress)->sin_addr;
 		regAddr = &((struct sockaddr_in6 *)&address)->sin6_addr.s6_addr[12];
 		regAddrlen = sizeof(struct in_addr);
@@ -1593,7 +1593,7 @@ get_fromaddr_by_name(
 static int
 get_mcast_options(int argc, char **argv, int i)
 {
-    char *address = XDM_DEFAULT_MCAST_ADDR6;
+    const char *address = XDM_DEFAULT_MCAST_ADDR6;
     int hopcount = 1;
     struct addrinfo hints;
     char portstr[6];
commit 3839d1480877818f3ccc04e25237d853bab210c3
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:33 2011 -0800

    LockServer: store path to LOCKDIR literal string in a const char *
    
    And instead of initializing to NULL, then resetting to LOCKDIR almost
    immediately (before ever using the NULL value), skip directly to setting
    it to LOCKDIR.
    
    tmppath variable is only used as input for generating the path name
    via calls to strlen, sprintf, etc.
    
    Fixes gcc warning of:
    utils.c: In function 'LockServer':
    utils.c:259:11: warning: assignment discards qualifiers from pointer target type
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/utils.c b/os/utils.c
index b49fd32..6461ed5 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -248,7 +248,7 @@ LockServer(void)
 {
   char tmp[PATH_MAX], pid_str[12];
   int lfd, i, haslock, l_pid, t;
-  char *tmppath = NULL;
+  const char *tmppath = LOCK_DIR;
   int len;
   char port[20];
 
@@ -256,8 +256,6 @@ LockServer(void)
   /*
    * Path names
    */
-  tmppath = LOCK_DIR;
-
   snprintf(port, sizeof(port), "%d", atoi(display));
   len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
 						strlen(LOCK_TMP_PREFIX);
commit af4113bfeb1d155f5f037c3492e50513336fa4a7
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:33 2011 -0800

    WriteToClient: preserve constness of buf while extracting length value
    
    Fixes gcc warning:
    io.c: In function 'WriteToClient':
    io.c:826:6: warning: cast discards qualifiers from pointer target type
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/io.c b/os/io.c
index 955bf8b..ebb8216 100644
--- a/os/io.c
+++ b/os/io.c
@@ -823,7 +823,7 @@ WriteToClient (ClientPtr who, int count, const void *__buf)
 	    CARD32 replylen;
 	    unsigned long bytesleft;
 
-	    replylen = ((xGenericReply *)buf)->length;
+	    replylen = ((const xGenericReply *)buf)->length;
 	    if (who->swapped)
 		swapl(&replylen);
 	    bytesleft = (replylen * 4) + SIZEOF(xReply) - count - padBytes;
commit 2c9800f91559fbb12dd276cf0536631104092f67
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:33 2011 -0800

    OsInit: store "/dev/null" in a const char *
    
    It's only passed as the input side of a strcpy and as the filename to
    fopen, so doesn't need to be non-const.   Fixes gcc warning:
    
    osinit.c: In function 'OsInit':
    osinit.c:154:28: warning: initialization discards qualifiers from pointer target type
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/osinit.c b/os/osinit.c
index acea682..ff3c45d 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -151,7 +151,7 @@ void
 OsInit(void)
 {
     static Bool been_here = FALSE;
-    static char* devnull = "/dev/null";
+    static const char* devnull = "/dev/null";
     char fname[PATH_MAX];
 
     if (!been_here) {
commit 50b1097643934c8caec9530e5eda6ed6534aaf61
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:33 2011 -0800

    Constify the reason string throughout the authorization check framework
    
    Almost all of the places the string is assigned point to a literal
    string constant, so use const char * for those, and const char **
    for function calls that return it via an argument.   Fortunately
    the top level function, ClientAuthorized, which returns the string
    as its return value is called from only one place, ProcEstablishConnection.
    
    ProcEstablishConnection stores either that return value or a string literal
    in char *reason.  It only uses reason as an argument to SendConnSetup.
    SendConnSetup passes the reason argument to strlen & WriteToClient,
    both of which already have const qualifiers on their args.
    Thus added const to the reason variable in ProcEstablishConnection
    and the reason argument to SendConnSetup.
    
    Fixes gcc warnings:
    dispatch.c: In function 'ProcEstablishConnection':
    dispatch.c:3711:9: warning: assignment discards qualifiers from pointer target type
    auth.c: In function 'CheckAuthorization':
    auth.c:218:14: warning: assignment discards qualifiers from pointer target type
    auth.c:220:20: warning: assignment discards qualifiers from pointer target type
    connection.c: In function 'ClientAuthorized':
    connection.c:683:3: warning: return discards qualifiers from pointer target type
    mitauth.c: In function 'MitCheckCookie':
    mitauth.c:88:13: warning: assignment discards qualifiers from pointer target type
    xdmauth.c:259:14: warning: assignment discards qualifiers from pointer target type
    xdmauth.c:270:14: warning: assignment discards qualifiers from pointer target type
    xdmauth.c:277:11: warning: assignment discards qualifiers from pointer target type
    xdmauth.c:293:15: warning: assignment discards qualifiers from pointer target type
    xdmauth.c:313:14: warning: assignment discards qualifiers from pointer target type
    xdmauth.c:322:11: warning: assignment discards qualifiers from pointer target type
    rpcauth.c: In function 'SecureRPCCheck':
    rpcauth.c:136:10: warning: assignment discards qualifiers from pointer target type
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index b39271f..048dff6 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3600,7 +3600,7 @@ ProcInitialConnection(ClientPtr client)
 }
 
 static int
-SendConnSetup(ClientPtr client, char *reason)
+SendConnSetup(ClientPtr client, const char *reason)
 {
     xWindowRoot *root;
     int i;
@@ -3699,7 +3699,8 @@ SendConnSetup(ClientPtr client, char *reason)
 int
 ProcEstablishConnection(ClientPtr client)
 {
-    char *reason, *auth_proto, *auth_string;
+    const char *reason;
+    char *auth_proto, *auth_string;
     xConnClientPrefix *prefix;
     REQUEST(xReq);
 
diff --git a/include/os.h b/include/os.h
index 0b50241..48ce329 100644
--- a/include/os.h
+++ b/include/os.h
@@ -127,7 +127,7 @@ extern _X_EXPORT void CloseWellKnownConnections(void);
 
 extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client*/);
 
-extern _X_EXPORT char *ClientAuthorized(
+extern _X_EXPORT const char *ClientAuthorized(
     ClientPtr /*client*/,
     unsigned int /*proto_n*/,
     char* /*auth_proto*/,
@@ -415,7 +415,7 @@ extern _X_EXPORT XID CheckAuthorization(
     unsigned int /*datalength*/,
     const char * /*data*/,
     ClientPtr /*client*/,
-    char ** /*reason*/
+    const char ** /*reason*/
 );
 
 extern _X_EXPORT void ResetAuthorization(void);
diff --git a/os/auth.c b/os/auth.c
index 9d36249..6669c14 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -163,7 +163,7 @@ CheckAuthorization (
     unsigned int data_length,
     const char	*data,
     ClientPtr client,
-    char	**reason)	/* failure message.  NULL for default msg */
+    const char	**reason)	/* failure message.  NULL for default msg */
 {
     int	i;
     struct stat buf;
diff --git a/os/connection.c b/os/connection.c
index 6f480de..8a677a7 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -629,7 +629,7 @@ AuthorizationIDOfClient(ClientPtr client)
  *
  *****************************************************************/
 
-char *
+const char *
 ClientAuthorized(ClientPtr client, 
     unsigned int proto_n, char *auth_proto, 
     unsigned int string_n, char *auth_string)
@@ -639,7 +639,7 @@ ClientAuthorized(ClientPtr client,
     int 		family;
     int			fromlen;
     XID	 		auth_id;
-    char	 	*reason = NULL;
+    const char	 	*reason = NULL;
     XtransConnInfo	trans_conn;
 
     priv = (OsCommPtr)client->osPrivate;
diff --git a/os/mitauth.c b/os/mitauth.c
index 4b8f6e9..477736e 100644
--- a/os/mitauth.c
+++ b/os/mitauth.c
@@ -76,7 +76,7 @@ MitCheckCookie (
     unsigned short	data_length,
     const char		*data,
     ClientPtr		client,
-    char		**reason)
+    const char		**reason)
 {
     struct auth	*auth;
 
diff --git a/os/osdep.h b/os/osdep.h
index 72bd7d7..71a7e44 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -137,7 +137,7 @@ typedef void (*AuthInitFunc) (AuthInitArgs);
 #define AuthAddCArgs unsigned short data_length, const char *data, XID id
 typedef int (*AuthAddCFunc) (AuthAddCArgs);
 
-#define AuthCheckArgs unsigned short data_length, const char *data, ClientPtr client, char **reason
+#define AuthCheckArgs unsigned short data_length, const char *data, ClientPtr client, const char **reason
 typedef XID (*AuthCheckFunc) (AuthCheckArgs);
 
 #define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap
diff --git a/os/rpcauth.c b/os/rpcauth.c
index 989a49a..63b97b6 100644
--- a/os/rpcauth.c
+++ b/os/rpcauth.c
@@ -128,7 +128,7 @@ static char rpc_error[MAXNETNAMELEN+50];
 
 _X_HIDDEN XID
 SecureRPCCheck (unsigned short data_length, const char *data,
-    ClientPtr client, char **reason)
+    ClientPtr client, const char **reason)
 {
     char *fullname;
     
diff --git a/os/xdmauth.c b/os/xdmauth.c
index b8cbada..733fda5 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -248,7 +248,7 @@ XdmClientAuthTimeout (long now)
 
 static XdmClientAuthPtr
 XdmAuthorizationValidate (unsigned char *plain, int length, 
-    XdmAuthKeyPtr rho, ClientPtr xclient, char **reason)
+    XdmAuthKeyPtr rho, ClientPtr xclient, const char **reason)
 {
     XdmClientAuthPtr	client, existing;
     long		now;
@@ -376,7 +376,7 @@ XdmAddCookie (unsigned short data_length, const char *data, XID id)
 
 XID
 XdmCheckCookie (unsigned short cookie_length, const char *cookie,
-    ClientPtr xclient, char **reason)
+    ClientPtr xclient, const char **reason)
 {
     XdmAuthorizationPtr	auth;
     XdmClientAuthPtr	client;
commit 99998196017ef38ec88459b50605aa20f628788b
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:33 2011 -0800

    Constify string for authorization protocol names
    
    gcc was warning from storing string constants in a char *name field:
    auth.c:64:1: warning: initialization discards qualifiers from pointer target type
    auth.c:72:1: warning: initialization discards qualifiers from pointer target type
    auth.c:81:1: warning: initialization discards qualifiers from pointer target type
    
    Making the field const requires changing AuthorizationFromID to take
    a const char ** pointer for the name argument which it sets to point
    to the matching name entry.
    
    Changing that argument requires changing its sole caller in the security
    extension to pass the address of a const char * variable to it, which it
    can do, since the only thing it does with the returned name is to pass
    it back to the RemoveAuthorization function that already expects a const
    char *name.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/security.c b/Xext/security.c
index 6fc1eaf..63892aa 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -171,7 +171,8 @@ SecurityDeleteAuthorization(
 {
     SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
     unsigned short name_len, data_len;
-    char *name, *data;
+    const char *name;
+    char *data;
     int status;
     int i;
     OtherClientsPtr pEventClient;
diff --git a/include/os.h b/include/os.h
index 1fd5367..0b50241 100644
--- a/include/os.h
+++ b/include/os.h
@@ -405,7 +405,7 @@ extern _X_EXPORT void InitAuthorization(char * /*filename*/);
 extern _X_EXPORT int AuthorizationFromID (
 	XID 		id,
 	unsigned short	*name_lenp,
-	char		**namep,
+	const char	**namep,
 	unsigned short	*data_lenp,
 	char		**datap);
 
diff --git a/os/auth.c b/os/auth.c
index 7685751..9d36249 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -48,7 +48,7 @@ from The Open Group.
 
 struct protocol {
     unsigned short   name_length;
-    char    *name;
+    const char         *name;
     AuthAddCFunc	Add;	/* new authorization data */
     AuthCheckFunc	Check;	/* verify client authorization data */
     AuthRstCFunc	Reset;	/* delete all authorization data entries */
@@ -236,7 +236,7 @@ int
 AuthorizationFromID (
 	XID 		id,
 	unsigned short	*name_lenp,
-	char		**namep,
+	const char	**namep,
 	unsigned short	*data_lenp,
 	char		**datap)
 {
commit 01834e99e461e2a8354f3b4aef7f14c5e83fa255
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:33 2011 -0800

    os/access.c: replace acmp & acopy macros with memcmp & memcpy calls
    
    No need to cast to char * now that all supported platforms use C89-standard
    void * argument types, so just drop the casts from acmp & acopy macros,
    which clears the gcc warnings for places const pointers were cast non-const:
    
    access.c: In function 'DefineSelf':
    access.c:786:3: warning: cast discards qualifiers from pointer target type
    access.c:795:6: warning: cast discards qualifiers from pointer target type
    access.c: In function 'NewHost':
    access.c:1293:9: warning: cast discards qualifiers from pointer target type
    access.c:1298:6: warning: cast discards qualifiers from pointer target type
    access.c:1309:5: warning: cast discards qualifiers from pointer target type
    
    Without the casts, acmp & acopy are just a funny way to write memcmp
    & memmove, so drop the macros and inline the calls, taking care to
    swap the first two arguments to memmove since it had swapped them.
    
    Since all the calls to memmove end up being to non-overlapping memory
    (mostly copying from an existing pointer to a newly allocated one),
    replace those with memcpy.
    
    And finally, don't actually call memcpy to copy 0 bytes from one place
    to another, since that's just a waste of a perfectly good function call.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/access.c b/os/access.c
index 0800c7f..b609442 100644
--- a/os/access.c
+++ b/os/access.c
@@ -176,12 +176,10 @@ SOFTWARE.
 
 Bool defeatAccessControl = FALSE;
 
-#define acmp(a1, a2, len) memcmp((char *)(a1), (char *)(a2), len)
-#define acopy(a1, a2, len) memmove((char *)(a2), (char *)(a1), len)
 #define addrEqual(fam, address, length, host) \
 			 ((fam) == (host)->family &&\
 			  (length) == (host)->len &&\
-			  !acmp (address, (host)->addr, length))
+			  !memcmp (address, (host)->addr, length))
 
 static int ConvertAddr(struct sockaddr * /*saddr*/,
 		       int * /*len*/,
@@ -371,13 +369,13 @@ DefineSelf (int fd)
 	switch (hp->h_addrtype) {
 	case AF_INET:
 	    inetaddr = (struct sockaddr_in *) (&(saddr.sa));
-	    acopy ( hp->h_addr, &(inetaddr->sin_addr), hp->h_length);
+	    memcpy ( &(inetaddr->sin_addr), hp->h_addr, hp->h_length);
 	    len = sizeof(saddr.sa);
 	    break;
 #if defined(IPv6) && defined(AF_INET6)
 	case AF_INET6:
 	    inet6addr = (struct sockaddr_in6 *) (&(saddr.sa));
-	    acopy ( hp->h_addr, &(inet6addr->sin6_addr), hp->h_length);
+	    memcpy ( &(inet6addr->sin6_addr), hp->h_addr, hp->h_length);
 	    len = sizeof(saddr.in6);
 	    break;
 #endif
@@ -398,7 +396,7 @@ DefineSelf (int fd)
 		{
 		    host->family = family;
 		    host->len = len;
-		    acopy ( addr, host->addr, len);
+		    memcpy ( host->addr, addr, len);
 		    host->next = selfhosts;
 		    selfhosts = host;
 		}
@@ -448,7 +446,7 @@ DefineLocalHost:
 	{
 	    host->family = FamilyLocalHost;
 	    host->len = 0;
-	    acopy("", host->addr, 0);
+	    /* Nothing to store in host->addr */
 	    host->next = selfhosts;
 	    selfhosts = host;
 	}
@@ -585,7 +583,7 @@ DefineSelf (int fd)
 	{
 	    host->family = family;
 	    host->len = len;
-	    acopy(addr, host->addr, len);
+	    memcpy(host->addr, addr, len);
 	    host->next = selfhosts;
 	    selfhosts = host;
 	}
@@ -717,7 +715,7 @@ DefineSelf (int fd)
 	if (host != NULL) {
 	    host->family = family;
 	    host->len = len;
-	    acopy(addr, host->addr, len);
+	    memcpy(host->addr, addr, len);
 	    host->next = selfhosts;
 	    selfhosts = host;
 	}
@@ -792,7 +790,7 @@ DefineSelf (int fd)
 	{
 	    host->family = FamilyLocalHost;
 	    host->len = 0;
-	    acopy("", host->addr, 0);
+	    /* Nothing to store in host->addr */
 	    host->next = selfhosts;
 	    selfhosts = host;
 	}
@@ -821,7 +819,7 @@ AugmentSelf(pointer from, int len)
 	return;
     host->family = family;
     host->len = len;
-    acopy(addr, host->addr, len);
+    memcpy(host->addr, addr, len);
     host->next = selfhosts;
     selfhosts = host;
 }
@@ -1306,7 +1304,7 @@ NewHost (int		family,
 	return FALSE;
     host->family = family;
     host->len = len;
-    acopy(addr, host->addr, len);
+    memcpy(host->addr, addr, len);
     host->next = validhosts;
     validhosts = host;
     return TRUE;
@@ -1400,7 +1398,7 @@ GetHosts (
 	    ((xHostEntry *)ptr)->family = host->family;
 	    ((xHostEntry *)ptr)->length = len;
 	    ptr += sizeof(xHostEntry);
-	    acopy (host->addr, ptr, len);
+	    memcpy (ptr, host->addr, len);
 	    ptr += pad_to_int32(len);
         }
     } else {
@@ -1763,7 +1761,7 @@ siHostnameAddrMatch(int family, pointer addr, int len,
 		hostaddrlen = a->ai_addrlen;
 		f = ConvertAddr(a->ai_addr,&hostaddrlen,&hostaddr);
 		if ((f == family) && (len == hostaddrlen) &&
-		  (acmp (addr, hostaddr, len) == 0) ) {
+		  (memcmp (addr, hostaddr, len) == 0) ) {
 		    res = TRUE;
 		    break;
 		}
@@ -1798,12 +1796,12 @@ siHostnameAddrMatch(int family, pointer addr, int len,
 		struct  sockaddr_in  sin;
 
     		sin.sin_family = hp->h_addrtype;
-		acopy ( *addrlist, &(sin.sin_addr), hp->h_length);
+		memcpy ( &(sin.sin_addr), *addrlist, hp->h_length);
 		hostaddrlen = sizeof(sin);
     		f = ConvertAddr ((struct sockaddr *)&sin, 
 		  &hostaddrlen, &hostaddr);
 		if ((f == family) && (len == hostaddrlen) &&
-		  (acmp (addr, hostaddr, len) == 0) ) {
+		  (memcmp (addr, hostaddr, len) == 0) ) {
 		    res = TRUE;
 		    break;
 		}
commit 020d83d361b0ab54ac962e97b12935be785f9a67
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:33 2011 -0800

    xres.c: Preserve constness of string returned by LookupResourceName
    
    MakeAtom now accepts a const char * so we don't need to cast down to
    char * anymore.   Fixes gcc warning of:
    
    xres.c: In function 'ProcXResQueryClientResources':
    xres.c:155:6: warning: cast discards qualifiers from pointer target type
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/xres.c b/Xext/xres.c
index b952728..232fbab 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -147,12 +147,12 @@ ProcXResQueryClientResources (ClientPtr client)
 
     if(num_types) {
         xXResType scratch;
-	char *name;
+	const char *name;
 
         for(i = 0; i < lastResourceType; i++) {
             if(!counts[i]) continue;
 
-	    name = (char *)LookupResourceName(i + 1);
+	    name = LookupResourceName(i + 1);
             if (strcmp(name, XREGISTRY_UNKNOWN))
 		scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
 	    else {
commit 2ddae8f0bd2a9ce0cd15bf3848393af29e615acf
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Dec 12 16:49:33 2011 -0800

    constify strings in resource name registry
    
    LookupResourceName already returned a const char *, so just needed
    to change the variable we're storing the list in to be a const char **
    and then add const to the name argument to RegisterResourceName
    (which just stores name in the array) and CreateNewResourceType
    (which just passes name to RegisterResourceName).
    
    Clears a bunch of gcc warnings of the form:
    registry.c:319:5: warning: passing argument 2 of 'RegisterResourceName' discards qualifiers from pointer target type
    registry.c:200:1: note: expected 'char *' but argument is of type 'const char *'
    
    and from all the extensions:
    damageext.c: In function 'DamageExtensionInit':
    damageext.c:490:5: warning: passing argument 2 of 'CreateNewResourceType' discards qualifiers from pointer target type
    ../include/resource.h:159:26: note: expected 'char *' but argument is of type 'const char *'
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/registry.c b/dix/registry.c
index fc35dbb..5ab25ad 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -41,7 +41,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 static FILE *fh;
 
-static char ***requests, **events, **errors, **resources;
+static char ***requests, **events, **errors;
+static const char **resources;
 static unsigned nmajor, *nminor, nevent, nerror, nresource;
 
 /*
@@ -197,7 +198,7 @@ RegisterExtensionNames(ExtensionEntry *extEntry)
  */
 
 void
-RegisterResourceName(RESTYPE resource, char *name)
+RegisterResourceName(RESTYPE resource, const char *name)
 {
     resource &= TypeMask;
 
diff --git a/dix/resource.c b/dix/resource.c
index eb9f049..be8a8f8 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -242,7 +242,7 @@ CallResourceStateCallback(ResourceState state, ResourceRec *res)
 }
 
 RESTYPE
-CreateNewResourceType(DeleteType deleteFunc, char *name)
+CreateNewResourceType(DeleteType deleteFunc, const char *name)
 {
     RESTYPE next = lastResourceType + 1;
     struct ResourceType *types;
diff --git a/include/registry.h b/include/registry.h
index 325f765..44f7925 100644
--- a/include/registry.h
+++ b/include/registry.h
@@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  * Registration functions.  The name string is not copied, so it must
  * not be a stack variable.
  */
-extern _X_EXPORT void RegisterResourceName(RESTYPE type, char *name);
+extern _X_EXPORT void RegisterResourceName(RESTYPE type, const char *name);
 extern _X_EXPORT void RegisterExtensionNames(ExtensionEntry *ext);
 
 /*
diff --git a/include/resource.h b/include/resource.h
index 772b7b8..5da2819 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -157,7 +157,7 @@ typedef Bool (*FindComplexResType)(
     pointer /*cdata*/);
 
 extern _X_EXPORT RESTYPE CreateNewResourceType(
-    DeleteType /*deleteFunc*/, char * /*name*/);
+    DeleteType /*deleteFunc*/, const char * /*name*/);
 
 extern _X_EXPORT void SetResourceTypeErrorValue(
     RESTYPE /*type*/, int /*errorValue*/);
commit 424dbde891486ad6a6c00c61a334031ff18f5556
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 9 10:08:55 2011 -0800

    CheckForEmptyMask does not need to declare int n twice
    
    Just use the existing n variable again in the ARGB_CURSOR loop
    instead of creating another one.
    
    Fixes gcc -Wshadow warning:
    cursor.c: In function 'CheckForEmptyMask':
    cursor.c:155:6: warning: declaration of 'n' shadows a previous local
    cursor.c:146:9: warning: shadowed declaration is here
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/cursor.c b/dix/cursor.c
index f29cb11..6bff447 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -152,7 +152,7 @@ CheckForEmptyMask(CursorBitsPtr bits)
     if (bits->argb)
     {
 	CARD32 *argb = bits->argb;
-	int n = bits->width * bits->height;
+	n = bits->width * bits->height;
 	while (n--)
 	    if (*argb++ & 0xff000000) return;
     }
commit b2bc38e4a553c29f49a0284333b34b4d6c8a8c12
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Dec 10 10:01:18 2011 -0800

    Even more correctly free config file names
    
    If we didn't go into the if (!autoconfig) { } block, the filename,
    dirname, and sysdirname pointers were never initialized, but we
    freed them outside the block, leading to potential memory corruption.
    
    Move the frees inside the block where they're initialized to avoid this.
    
    To avoid similar problems, move the declarations of the variables that
    are only used in this block inside the block.
    
    Regression introduced by commit 3d635fe84d6de53e2f74203b10e89f7851fe3fc1
    
    Found by gcc warning:
    xf86Config.c: In function 'xf86HandleConfigFile':
    xf86Config.c:2303:11: warning: 'filename' may be used uninitialized in this function
    xf86Config.c:2303:22: warning: 'dirname' may be used uninitialized in this function
    xf86Config.c:2303:32: warning: 'sysdirname' may be used uninitialized in this function
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index fef4bf1..94d2b15 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2300,15 +2300,16 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
 ConfigStatus
 xf86HandleConfigFile(Bool autoconfig)
 {
-    char *filename, *dirname, *sysdirname;
-    const char *filesearch, *dirsearch;
-    MessageType filefrom = X_DEFAULT;
-    MessageType dirfrom = X_DEFAULT;
     char *scanptr;
     Bool singlecard = 0;
     Bool implicit_layout = FALSE;
 
     if (!autoconfig) {
+	char *filename, *dirname, *sysdirname;
+	const char *filesearch, *dirsearch;
+	MessageType filefrom = X_DEFAULT;
+	MessageType dirfrom = X_DEFAULT;
+
 	if (getuid() == 0) {
 	    filesearch = ROOT_CONFIGPATH;
 	    dirsearch = ROOT_CONFIGDIRPATH;
@@ -2350,11 +2351,11 @@ xf86HandleConfigFile(Bool autoconfig)
 			sysdirname);
 	if (!filename && !dirname && !sysdirname)
 	    return CONFIG_NOFILE;
-    }
 
-    free(filename);
-    free(dirname);
-    free(sysdirname);
+	free(filename);
+	free(dirname);
+	free(sysdirname);
+    }
 
     if ((xf86configptr = xf86readConfigFile ()) == NULL) {
 	xf86Msg(X_ERROR, "Problem parsing the config file\n");
commit 33d6e6743d86324c2078f156991b16ac4f2593fc
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Wed Dec 7 19:06:05 2011 -0800

    xf86RegisterRootWindowProperty is confused about xnfcalloc
    
    It will never return NULL, so don't try to handle a NULL condition,
    since that just confuses programmers and static analyzers.
    
    It uses calloc, so all the allocated memory is cleared, so there's
    no point looping over the memory to manually initialize it NULL.
    
    And just because it's annoying, it doesn't need to be the only
    place in this file to do if (NULL==...) instead of if (... == NULL).
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>

diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index d99522c..248ccf4 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1734,7 +1734,6 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
 			       int format, unsigned long len, pointer value )
 {
     RootWinPropPtr pNewProp = NULL, pRegProp;
-    int i;
     Bool existing = FALSE;
 
     DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
@@ -1775,15 +1774,11 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
 
     DebugF("new property filled\n");
 
-    if (NULL==xf86RegisteredPropertiesTable) {
+    if (xf86RegisteredPropertiesTable == NULL) {
       DebugF("creating xf86RegisteredPropertiesTable[] size %d\n",
 	     xf86NumScreens);
-      if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) {
-	return BadAlloc;
-      }
-      for (i=0; i<xf86NumScreens; i++) {
-	xf86RegisteredPropertiesTable[i] = NULL;
-      }
+      xf86RegisteredPropertiesTable =
+	  xnfcalloc(sizeof(RootWinProp), xf86NumScreens);
     }
 
     DebugF("xf86RegisteredPropertiesTable %p\n",


More information about the xorg-commit mailing list