[Xquartz-changes] xserver: Branch 'master' - 45 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Fri Nov 25 09:41:54 PST 2011


 Xext/security.c                         |    4 
 Xext/sync.c                             |    4 
 Xext/syncsrv.h                          |    4 
 Xext/xtest.c                            |    9 -
 Xext/xvmc.c                             |    6 -
 Xi/extinit.c                            |    4 
 Xi/xiproperty.c                         |    4 
 configure.ac                            |    8 -
 dix/atom.c                              |    7 -
 dix/devices.c                           |    2 
 dix/extension.c                         |    8 -
 doc/Xinput.xml                          |    2 
 doc/Xserver-spec.xml                    |    4 
 doc/dtrace/Xserver-DTrace.xml           |    2 
 exa/exa_render.c                        |    6 -
 glx/glxdri.c                            |   15 ++
 glx/glxdri2.c                           |   14 +-
 glx/glxdriswrast.c                      |   14 +-
 glx/glxscreens.c                        |   10 +
 glx/single2.c                           |    4 
 hw/dmx/config/Makefile.am               |    4 
 hw/dmx/config/dmxcompat.c               |    4 
 hw/dmx/config/scanner.l                 |    3 
 hw/dmx/dmxinit.c                        |   13 --
 hw/dmx/doc/dmx.xml                      |    2 
 hw/dmx/doc/scaled.xml                   |    2 
 hw/dmx/examples/ev.c                    |    4 
 hw/dmx/glxProxy/compsize.c              |    1 
 hw/dmx/glxProxy/compsize.h              |   51 ++++++++
 hw/dmx/glxProxy/g_renderswap.c          |    1 
 hw/dmx/glxProxy/glxcmds.c               |    2 
 hw/dmx/glxProxy/glxcmds.h               |   37 ++++++
 hw/dmx/glxProxy/glxcmdsswap.c           |    3 
 hw/dmx/glxProxy/glxscreens.c            |    5 
 hw/kdrive/ephyr/ephyrhostvideo.c        |    9 -
 hw/kdrive/linux/linux.c                 |    2 
 hw/kdrive/src/kinput.c                  |    4 
 hw/vfb/InitOutput.c                     |    3 
 hw/xfree86/common/Makefile.am           |    2 
 hw/xfree86/common/xf86.h                |    1 
 hw/xfree86/common/xf86AutoConfig.c      |    2 
 hw/xfree86/common/xf86Config.c          |   21 ++-
 hw/xfree86/common/xf86Config.h          |    2 
 hw/xfree86/common/xf86Configure.c       |   71 ++++++++++--
 hw/xfree86/common/xf86Globals.c         |    2 
 hw/xfree86/common/xf86Mode.c            |    4 
 hw/xfree86/common/xf86Opt.h             |    4 
 hw/xfree86/common/xf86Option.c          |   12 +-
 hw/xfree86/common/xf86PM.c              |    4 
 hw/xfree86/common/xf86Priv.h            |    2 
 hw/xfree86/common/xf86ShowOpts.c        |  130 ----------------------
 hw/xfree86/common/xf86Xinput.c          |    5 
 hw/xfree86/common/xf86pciBus.c          |   30 +----
 hw/xfree86/common/xf86sbusBus.c         |    2 
 hw/xfree86/ddc/xf86DDC.h                |    5 
 hw/xfree86/doc/ddxDesign.xml            |    4 
 hw/xfree86/fbdevhw/fbdevhw.c            |    6 -
 hw/xfree86/i2c/msp3430.c                |    5 
 hw/xfree86/loader/loadmod.c             |   11 -
 hw/xfree86/modes/xf86Crtc.c             |    8 -
 hw/xfree86/modes/xf86Crtc.h             |    2 
 hw/xfree86/modes/xf86EdidModes.c        |    2 
 hw/xfree86/modes/xf86Modes.c            |    4 
 hw/xfree86/os-support/bsd/bsd_init.c    |   10 -
 hw/xfree86/os-support/bus/Sbus.c        |   12 +-
 hw/xfree86/os-support/linux/lnx_init.c  |    2 
 hw/xfree86/os-support/solaris/sun_agp.c |    2 
 hw/xfree86/parser/Flags.c               |    2 
 hw/xfree86/parser/InputClass.c          |   15 ++
 hw/xfree86/parser/configProcs.h         |    6 -
 hw/xfree86/parser/scan.c                |   52 ++++----
 hw/xfree86/parser/xf86Optrec.h          |    2 
 hw/xfree86/parser/xf86Parser.h          |   10 -
 hw/xfree86/ramdac/BTPriv.h              |    2 
 hw/xfree86/ramdac/IBMPriv.h             |    2 
 hw/xfree86/ramdac/TIPriv.h              |    2 
 hw/xfree86/utils/gtf/gtf.c              |    4 
 hw/xfree86/vbe/vbe.c                    |    2 
 hw/xfree86/x86emu/debug.c               |    2 
 hw/xquartz/xpr/dri.c                    |    3 
 hw/xwin/winconfig.c                     |    4 
 include/Makefile.am                     |    1 
 include/dix-config.h.in                 |    3 
 include/exevents.h                      |    2 
 include/extension.h                     |    4 
 include/extinit.h                       |    2 
 include/extnsionst.h                    |    4 
 include/input.h                         |    4 
 include/misc.h                          |    2 
 include/os.h                            |   10 +
 include/xkbfile.h                       |    4 
 include/xkbsrv.h                        |    4 
 mi/miinitext.c                          |    6 -
 os/Makefile.am                          |    4 
 os/access.c                             |   10 -
 os/client.c                             |    8 -
 os/connection.c                         |   15 +-
 os/log.c                                |    2 
 os/osinit.c                             |    2 
 os/rpcauth.c                            |    7 -
 os/strndup.c                            |   49 ++++++++
 os/utils.c                              |   14 +-
 os/xdmcp.c                              |    4 
 randr/randrstr.h                        |    5 
 randr/rrinfo.c                          |    2 
 render/filter.c                         |    6 -
 render/glyphstr.h                       |    3 
 render/picturestr.h                     |    6 -
 render/render.c                         |    4 
 test/.gitignore                         |    1 
 test/Makefile.am                        |    5 
 test/string.c                           |   69 +++++++++++
 test/xi2/Makefile.am                    |   10 +
 xkb/ddxList.c                           |    2 
 xkb/ddxLoad.c                           |    6 -
 xkb/maprules.c                          |    5 
 xkb/xkbInit.c                           |   25 +---
 xkb/xkbfmisc.c                          |    2 
 xkb/xkbout.c                            |    6 -
 xkb/xkbtext.c                           |  189 +++++++++++++++-----------------
 120 files changed, 709 insertions(+), 554 deletions(-)

New commits:
commit b2015a2c01711646bb7ae23d684abee0cd55d4d0
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Nov 24 13:54:08 2011 -0800

    dmx: Build fix for -Werror=implicit-function-declaration on linux
    
    Fixes regression introduced by: 6e6d732bac3c21cb85f8e998908f9b393630e5f8
    Found-by: Tinderbox
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    CC: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/dmx/config/dmxcompat.c b/hw/dmx/config/dmxcompat.c
index 98c52eb..1c72084 100644
--- a/hw/dmx/config/dmxcompat.c
+++ b/hw/dmx/config/dmxcompat.c
@@ -42,6 +42,7 @@
 #include <dmx-config.h>
 #endif
 
+#include "os.h"
 #include "dmxconfig.h"
 #include "dmxparse.h"
 #include "dmxcompat.h"
commit 873a1ace3646994adf95961f48719e95dcade7a2
Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Tue Nov 1 10:57:56 2011 -0200

    parser: free val.str after xstrtokenize
    
    After we tokenize val.str, we discard it.
    
    This is just one example:
    6 bytes in 1 blocks are definitely lost in loss record 24 of 652
       at 0x4C2779D: malloc (in vgpreload_memcheck-amd64-linux.so)
       by 0x4D744D: xf86getToken (scan.c:400)
       by 0x4D75F1: xf86getSubToken (scan.c:462)
       by 0x4DB060: xf86parseInputClassSection (InputClass.c:145)
       by 0x4D664C: xf86readConfigFile (read.c:184)
       by 0x490556: xf86HandleConfigFile (xf86Config.c:2360)
       by 0x49AA77: InitOutput (xf86Init.c:365)
       by 0x425A7A: main (main.c:204)
    
    Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 1128995..2cdc912 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -128,54 +128,63 @@ xf86parseInputClassSection(void)
                 Error(QUOTE_MSG, "MatchProduct");
             add_group_entry(&ptr->match_product,
                             xstrtokenize(val.str, TOKEN_SEP));
+            free(val.str);
             break;
         case MATCH_VENDOR:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchVendor");
             add_group_entry(&ptr->match_vendor,
                             xstrtokenize(val.str, TOKEN_SEP));
+            free(val.str);
             break;
         case MATCH_DEVICE_PATH:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchDevicePath");
             add_group_entry(&ptr->match_device,
                             xstrtokenize(val.str, TOKEN_SEP));
+            free(val.str);
             break;
         case MATCH_OS:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchOS");
             add_group_entry(&ptr->match_os,
                             xstrtokenize(val.str, TOKEN_SEP));
+            free(val.str);
             break;
         case MATCH_PNPID:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchPnPID");
             add_group_entry(&ptr->match_pnpid,
                             xstrtokenize(val.str, TOKEN_SEP));
+            free(val.str);
             break;
         case MATCH_USBID:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchUSBID");
             add_group_entry(&ptr->match_usbid,
                             xstrtokenize(val.str, TOKEN_SEP));
+            free(val.str);
             break;
         case MATCH_DRIVER:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchDriver");
             add_group_entry(&ptr->match_driver,
                             xstrtokenize(val.str, TOKEN_SEP));
+            free(val.str);
             break;
         case MATCH_TAG:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchTag");
             add_group_entry(&ptr->match_tag,
                             xstrtokenize(val.str, TOKEN_SEP));
+            free(val.str);
             break;
         case MATCH_LAYOUT:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchLayout");
             add_group_entry(&ptr->match_layout,
                             xstrtokenize(val.str, TOKEN_SEP));
+            free(val.str);
             break;
         case MATCH_IS_KEYBOARD:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
commit d41987d77c903e00cca7bcf3e04ed07151e3bb4d
Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Tue Nov 1 10:42:36 2011 -0200

    parser: free val.str after xf86getBoolValue
    
    After we convert the value to a boolean, we discard the string.
    
    This is just one example:
    
    3 bytes in 1 blocks are definitely lost in loss record 5 of 657
       at 0x4C2779D: malloc (vgpreload_memcheck-amd64-linux.so)
       by 0x4D744D: xf86getToken (scan.c:400)
       by 0x4D75F1: xf86getSubToken (scan.c:462)
       by 0x4DB3E0: xf86parseInputClassSection (InputClass.c:189)
       by 0x4D664C: xf86readConfigFile (read.c:184)
       by 0x490556: xf86HandleConfigFile (xf86Config.c:2360)
       by 0x49AA77: InitOutput (xf86Init.c:365)
       by 0x425A7A: main (main.c:204)
    
    Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 3f80170..1128995 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -182,6 +182,7 @@ xf86parseInputClassSection(void)
                 Error(QUOTE_MSG, "MatchIsKeyboard");
             ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val,
                                                     val.str);
+            free(val.str);
             if (!ptr->is_keyboard.set)
                 Error(BOOL_MSG, "MatchIsKeyboard");
             break;
@@ -190,6 +191,7 @@ xf86parseInputClassSection(void)
                 Error(QUOTE_MSG, "MatchIsPointer");
             ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val,
                                                    val.str);
+            free(val.str);
             if (!ptr->is_pointer.set)
                 Error(BOOL_MSG, "MatchIsPointer");
             break;
@@ -198,6 +200,7 @@ xf86parseInputClassSection(void)
                 Error(QUOTE_MSG, "MatchIsJoystick");
             ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val,
                                                     val.str);
+            free(val.str);
             if (!ptr->is_joystick.set)
                 Error(BOOL_MSG, "MatchIsJoystick");
             break;
@@ -206,6 +209,7 @@ xf86parseInputClassSection(void)
                 Error(QUOTE_MSG, "MatchIsTablet");
             ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val,
                                                   val.str);
+            free(val.str);
             if (!ptr->is_tablet.set)
                 Error(BOOL_MSG, "MatchIsTablet");
             break;
@@ -214,6 +218,7 @@ xf86parseInputClassSection(void)
                 Error(QUOTE_MSG, "MatchIsTouchpad");
             ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val,
                                                     val.str);
+            free(val.str);
             if (!ptr->is_touchpad.set)
                 Error(BOOL_MSG, "MatchIsTouchpad");
             break;
@@ -222,6 +227,7 @@ xf86parseInputClassSection(void)
                 Error(QUOTE_MSG, "MatchIsTouchscreen");
             ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val,
                                                        val.str);
+            free(val.str);
             if (!ptr->is_touchscreen.set)
                 Error(BOOL_MSG, "MatchIsTouchscreen");
             break;
commit d5c7338b3eaea55177ade6fcba71a47ccd5547f5
Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Mon Oct 31 17:54:03 2011 -0200

    parser: free scandir's list
    
    v2: move the free()s to the function that calls scandir
    
    80 bytes in 1 blocks are definitely lost in loss record 411 of 631
       at 0x4C2779D: malloc (vgpreload_memcheck-amd64-linux.so)
       by 0x4C27927: realloc (vgpreload_memcheck-amd64-linux.so)
       by 0x696A80D: scandir (scandir.c:108)
       by 0x4D8828: OpenConfigDir (scan.c:854)
       by 0x4D8A43: xf86openConfigDirFiles (scan.c:952)
       by 0x49031F: xf86HandleConfigFile (xf86Config.c:2327)
       by 0x49A9E3: InitOutput (xf86Init.c:365)
       by 0x425A7A: main (main.c:204)
    
    Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index d22d6ab..9099227 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -800,14 +800,12 @@ AddConfigDirFiles(const char *dirpath, struct dirent **list, int num)
 				       "files opened\n");
 				warnOnce = TRUE;
 			}
-			free(list[i]);
 			continue;
 		}
 
 		path = malloc(PATH_MAX + 1);
 		snprintf(path, PATH_MAX + 1, "%s/%s", dirpath,
 			 list[i]->d_name);
-		free(list[i]);
 		file = fopen(path, "r");
 		if (!file) {
 			free(path);
@@ -858,8 +856,10 @@ OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
 		if (!found) {
 			free(dirpath);
 			dirpath = NULL;
-			free(list);
 		}
+		while (num--)
+			free(list[num]);
+		free(list);
 	}
 
 	free(pathcopy);
commit 3d635fe84d6de53e2f74203b10e89f7851fe3fc1
Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Sun Oct 30 18:04:59 2011 -0200

    Correctly free config file names
    
    We call xf86penConfigDirFiles twice, so we overwrite the configDirPath
    variable, losing the pointer. If we move the pointer management to the
    upper layer (the function callers), they will be able to call these
    functions as many times as they want, but they'll have to free those
    returned values.
    
    v2: don't leak inside XWin
    
    4,097 bytes in 1 blocks are definitely lost in loss record 625 of 632
       at 0x4C2779D: malloc (in vgpreload_memcheck-amd64-linux.so)
       by 0x4D7899: DoSubstitution (scan.c:615)
       by 0x4D87B0: OpenConfigDir (scan.c:845)
       by 0x4D8A2D: xf86openConfigDirFiles (scan.c:955)
       by 0x49031F: xf86HandleConfigFile (xf86Config.c:2327)
       by 0x49A9BF: InitOutput (xf86Init.c:365)
       by 0x425A7A: main (main.c:204)
    
    Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 228021b..fef4bf1 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2300,7 +2300,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
 ConfigStatus
 xf86HandleConfigFile(Bool autoconfig)
 {
-    const char *filename, *dirname, *sysdirname;
+    char *filename, *dirname, *sysdirname;
     const char *filesearch, *dirsearch;
     MessageType filefrom = X_DEFAULT;
     MessageType dirfrom = X_DEFAULT;
@@ -2352,6 +2352,10 @@ xf86HandleConfigFile(Bool autoconfig)
 	    return CONFIG_NOFILE;
     }
 
+    free(filename);
+    free(dirname);
+    free(sysdirname);
+
     if ((xf86configptr = xf86readConfigFile ()) == NULL) {
 	xf86Msg(X_ERROR, "Problem parsing the config file\n");
 	return CONFIG_PARSE_ERROR;
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index e25b1ad..d22d6ab 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -101,8 +101,6 @@ static int builtinIndex = 0;
 static int configPos = 0;		/* current readers position */
 static int configLineNo = 0;	/* linenumber */
 static char *configBuf, *configRBuf;	/* buffer for lines */
-static char *configPath;		/* path to config file */
-static char *configDirPath;		/* path to config dir */
 static char *configSection = NULL;	/* name of current section being parsed */
 static int numFiles = 0;		/* number of config files */
 static int curFileIndex = 0;		/* index of current config file */
@@ -894,7 +892,8 @@ xf86initConfigFiles(void)
  * of the located files.
  *
  * The return value is a pointer to the actual name of the file that was
- * opened.  When no file is found, the return value is NULL.
+ * opened.  When no file is found, the return value is NULL. The caller should
+ * free() the returned value.
  *
  * The escape sequences allowed in the search path are defined above.
  *
@@ -916,7 +915,7 @@ xf86initConfigFiles(void)
 							"%P/lib/X11/%X"
 #endif
 
-const char *
+char *
 xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
 {
 	if (!path || !path[0])
@@ -925,8 +924,7 @@ xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
 		projroot = PROJECTROOT;
 
 	/* Search for a config file */
-	configPath = OpenConfigFile(path, cmdline, projroot, XCONFIGFILE);
-	return configPath;
+	return OpenConfigFile(path, cmdline, projroot, XCONFIGFILE);
 }
 
 /*
@@ -939,12 +937,13 @@ xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
  * fails if it is not found.
  *
  * The return value is a pointer to the actual name of the direcoty that was
- * opened.  When no directory is found, the return value is NULL.
+ * opened.  When no directory is found, the return value is NULL. The caller
+ * should free() the returned value.
  *
  * The escape sequences allowed in the search path are defined above.
  *
  */
-const char *
+char *
 xf86openConfigDirFiles(const char *path, const char *cmdline,
 		       const char *projroot)
 {
@@ -954,8 +953,7 @@ xf86openConfigDirFiles(const char *path, const char *cmdline,
 		projroot = PROJECTROOT;
 
 	/* Search for the multiconf directory */
-	configDirPath = OpenConfigDir(path, cmdline, projroot, XCONFIGDIR);
-	return configDirPath;
+	return OpenConfigDir(path, cmdline, projroot, XCONFIGDIR);
 }
 
 void
@@ -963,10 +961,6 @@ xf86closeConfigFile (void)
 {
 	int i;
 
-	free (configPath);
-	configPath = NULL;
-	free (configDirPath);
-	configDirPath = NULL;
 	free (configRBuf);
 	configRBuf = NULL;
 	free (configBuf);
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index c12bd56..7d4662b 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -487,10 +487,10 @@ xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
  * prototypes for public functions
  */
 extern void xf86initConfigFiles(void);
-extern const char *xf86openConfigFile(const char *path, const char *cmdline,
-				      const char *projroot);
-extern const char *xf86openConfigDirFiles(const char *path, const char *cmdline,
-					  const char *projroot);
+extern char *xf86openConfigFile(const char *path, const char *cmdline,
+				const char *projroot);
+extern char *xf86openConfigDirFiles(const char *path, const char *cmdline,
+				    const char *projroot);
 extern void xf86setBuiltinConfig(const char *config[]);
 extern XF86ConfigPtr xf86readConfigFile(void);
 extern void xf86closeConfigFile(void);
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index 76bf8e2..4dbbe7c 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -117,7 +117,7 @@ Bool
 winReadConfigfile ()
 {
   Bool		retval = TRUE;
-  const char	*filename, *dirname;
+  char		*filename, *dirname;
   MessageType	filefrom = X_DEFAULT;
   MessageType	dirfrom = X_DEFAULT;
   char		*xf86ConfigFile = NULL;
@@ -169,6 +169,8 @@ winReadConfigfile ()
     {
       return FALSE;
     }
+  free(filename);
+  free(dirname);
   if ((g_xf86configptr = xf86readConfigFile ()) == NULL)
     {
       winMsg (X_ERROR, "Problem parsing the config file\n");
commit 0ae087e13192d9b498db782be5ba49ca91a81547
Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Sat Oct 29 18:33:24 2011 -0200

    glx: don't leak driConfigs
    
    For dri, dri2 and driswrast.
    
    12,968 (584 direct, 12,384 indirect) bytes in 1 blocks are definitely lost in loss record 569 of 570
       at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x7821E3B: driConcatConfigs (utils.c:560)
       by 0x7827CF2: dri_fill_in_modes (dri_screen.c:224)
       by 0x782831E: dri_init_screen_helper (dri_screen.c:405)
       by 0x7826C03: drisw_init_screen (drisw.c:266)
       by 0x782225F: driCreateNewScreen (drisw_util.c:69)
       by 0x4826E2: __glXDRIscreenProbe (glxdriswrast.c:451)
       by 0x4812FA: GlxExtensionInit (glxext.c:327)
       by 0x41FB14: InitExtensions (miinitext.c:471)
       by 0x568622: main (main.c:208)
    
    Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/glx/glxdri.c b/glx/glxdri.c
index 244eac6..326f539 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -78,6 +78,7 @@ struct __GLXDRIscreen {
     const __DRIlegacyExtension *legacy;
     const __DRIcopySubBufferExtension *copySubBuffer;
     const __DRIswapControlExtension *swapControl;
+    const __DRIconfig **driConfigs;
 
 #ifdef __DRI_TEX_OFFSET
     const __DRItexOffsetExtension *texOffset;
@@ -585,6 +586,8 @@ static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
 static void
 __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 {
+    int i;
+
     __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
 
     screen->core->destroyScreen(screen->driScreen);
@@ -593,6 +596,12 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 
     __glXScreenDestroy(baseScreen);
 
+    if (screen->driConfigs) {
+	for (i = 0; screen->driConfigs[i] != NULL; i++)
+	    free((__DRIconfig **)screen->driConfigs[i]);
+	free(screen->driConfigs);
+    }
+
     free(screen);
 }
 
@@ -967,7 +976,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     Bool isCapable;
     size_t buffer_size;
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    const __DRIconfig **driConfigs;
 
     if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
 	!DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
@@ -1095,7 +1103,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 					   pSAREA,
 					   fd,
 					   loader_extensions,
-					   &driConfigs,
+					   &screen->driConfigs,
 					   screen);
 
     if (screen->driScreen == NULL) {
@@ -1105,7 +1113,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     }
 
     screen->base.fbconfigs = glxConvertConfigs(screen->core,
-					       driConfigs, GLX_WINDOW_BIT);
+					       screen->driConfigs,
+					       GLX_WINDOW_BIT);
 
     initializeExtensions(screen);
 
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index e872258..8187a3e 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -73,6 +73,7 @@ struct __GLXDRIscreen {
     const __DRIcopySubBufferExtension *copySubBuffer;
     const __DRIswapControlExtension *swapControl;
     const __DRItexBufferExtension *texBuffer;
+    const __DRIconfig **driConfigs;
 
     unsigned char glx_enable_bits[__GLX_EXT_BYTES];
 };
@@ -363,6 +364,8 @@ static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
 static void
 __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 {
+    int i;
+
     __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
 
     (*screen->core->destroyScreen)(screen->driScreen);
@@ -371,6 +374,12 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 
     __glXScreenDestroy(baseScreen);
 
+    if (screen->driConfigs) {
+	for (i = 0; screen->driConfigs[i] != NULL; i++)
+	    free((__DRIconfig **)screen->driConfigs[i]);
+	free(screen->driConfigs);
+    }
+
     free(screen);
 }
 
@@ -688,7 +697,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     __GLXDRIscreen *screen;
     size_t buffer_size;
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    const __DRIconfig **driConfigs;
 
     screen = calloc(1, sizeof *screen);
     if (screen == NULL)
@@ -720,7 +728,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 	(*screen->dri2->createNewScreen)(pScreen->myNum,
 					 screen->fd,
 					 loader_extensions,
-					 &driConfigs,
+					 &screen->driConfigs,
 					 screen);
 
     if (screen->driScreen == NULL) {
@@ -731,7 +739,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     initializeExtensions(screen);
 
-    screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs,
+    screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs,
 					       GLX_WINDOW_BIT |
 					       GLX_PIXMAP_BIT |
 					       GLX_PBUFFER_BIT);
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index ed142c1..d064a05 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -74,6 +74,7 @@ struct __GLXDRIscreen {
     const __DRIswrastExtension *swrast;
     const __DRIcopySubBufferExtension *copySubBuffer;
     const __DRItexBufferExtension *texBuffer;
+    const __DRIconfig **driConfigs;
 };
 
 struct __GLXDRIcontext {
@@ -240,6 +241,8 @@ static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
 static void
 __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 {
+    int i;
+
     __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
 
     (*screen->core->destroyScreen)(screen->driScreen);
@@ -248,6 +251,12 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 
     __glXScreenDestroy(baseScreen);
 
+    if (screen->driConfigs) {
+	for (i = 0; screen->driConfigs[i] != NULL; i++)
+	    free((__DRIconfig **)screen->driConfigs[i]);
+	free(screen->driConfigs);
+    }
+
     free(screen);
 }
 
@@ -426,7 +435,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 {
     const char *driverName = "swrast";
     __GLXDRIscreen *screen;
-    const __DRIconfig **driConfigs;
 
     screen = calloc(1, sizeof *screen);
     if (screen == NULL)
@@ -450,7 +458,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     screen->driScreen =
 	(*screen->swrast->createNewScreen)(pScreen->myNum,
 					   loader_extensions,
-					   &driConfigs,
+					   &screen->driConfigs,
 					   screen);
 
     if (screen->driScreen == NULL) {
@@ -461,7 +469,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     initializeExtensions(screen);
 
-    screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs,
+    screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs,
 					       GLX_WINDOW_BIT |
 					       GLX_PIXMAP_BIT |
 					       GLX_PBUFFER_BIT);
commit d26fae246d7c451b4d5ffe24fdb959d4bd00b107
Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Tue Oct 25 14:56:35 2011 -0200

    glx: don't leak fbconfigs
    
    29,952 (208 direct, 29,744 indirect) bytes in 1 blocks are definitely lost in loss record 573 of 573
       at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x4829BC: createModeFromConfig (glxdricommon.c:131)
       by 0x482C09: glxConvertConfigs (glxdricommon.c:185)
       by 0x482788: __glXDRIscreenProbe (glxdriswrast.c:468)
       by 0x4812FA: GlxExtensionInit (glxext.c:327)
       by 0x41FB14: InitExtensions (miinitext.c:471)
       by 0x568636: main (main.c:208)
    
    Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index ebb9747..928cf0c 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -419,6 +419,15 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
 
 void __glXScreenDestroy(__GLXscreen *screen)
 {
+    __GLXconfig *head, *next;
+
+    head = screen->fbconfigs;
+    while (head) {
+	next = head->next;
+	free(head);
+	head = next;
+    }
+
     free(screen->GLXvendor);
     free(screen->GLXextensions);
     free(screen->GLextensions);
commit 305a8bcb2fc6f87f8d891fcb774198b6fd118ee1
Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Thu Oct 20 17:39:29 2011 -0200

    glx: fix memory leak when destroying screen
    
    1,152 bytes in 1 blocks are definitely lost in loss record 536 of 575
       at 0x4C25E84: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x483820: __glXScreenInit (glxscreens.c:357)
       by 0x48271C: __glXDRIscreenProbe (glxdriswrast.c:469)
       by 0x4812BE: GlxExtensionInit (glxext.c:327)
       by 0x41FB14: InitExtensions (miinitext.c:471)
       by 0x5685AE: main (main.c:208)
    
    Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index c4ad426..ebb9747 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -422,4 +422,5 @@ void __glXScreenDestroy(__GLXscreen *screen)
     free(screen->GLXvendor);
     free(screen->GLXextensions);
     free(screen->GLextensions);
+    free(screen->visuals);
 }
commit f405dfffe7d5db81d398615a80acbeba7e014ada
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Nov 7 22:14:30 2011 +0000

    dmx: Build fix for -Werror=implicit-function-declaration
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/hw/dmx/glxProxy/compsize.c b/hw/dmx/glxProxy/compsize.c
index 9a40d65..5a5d5d0 100644
--- a/hw/dmx/glxProxy/compsize.c
+++ b/hw/dmx/glxProxy/compsize.c
@@ -29,6 +29,7 @@
  */
 
 #include <GL/gl.h>
+#include "compsize.h"
 
 GLint __glFogiv_size(GLenum pname)
 {
diff --git a/hw/dmx/glxProxy/compsize.h b/hw/dmx/glxProxy/compsize.h
new file mode 100644
index 0000000..856c6f5
--- /dev/null
+++ b/hw/dmx/glxProxy/compsize.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2011 Apple Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __compsize_h__
+#define __compsize_h__
+
+extern GLint __glColorTableParameterfv_size(GLenum pname);
+extern GLint __glColorTableParameteriv_size(GLenum pname);
+extern GLint __glConvolutionParameterfv_size(GLenum pname);
+extern GLint __glConvolutionParameteriv_size(GLenum pname);
+extern GLint __glFogfv_size(GLenum pname);
+extern GLint __glFogiv_size(GLenum pname);
+extern GLint __glLightModelfv_size(GLenum pname);
+extern GLint __glLightModeliv_size(GLenum pname);
+extern GLint __glLightfv_size(GLenum pname);
+extern GLint __glLightiv_size(GLenum pname);
+extern GLint __glMaterialfv_size(GLenum pname);
+extern GLint __glMaterialiv_size(GLenum pname);
+extern GLint __glTexEnvfv_size(GLenum e);
+extern GLint __glTexEnviv_size(GLenum e);
+extern GLint __glTexGendv_size(GLenum e);
+extern GLint __glTexGenfv_size(GLenum e);
+extern GLint __glTexGeniv_size(GLenum e);
+extern GLint __glTexParameterfv_size(GLenum e);
+extern GLint __glTexParameteriv_size(GLenum e);
+
+#endif /* !__compsize_h__ */
diff --git a/hw/dmx/glxProxy/g_renderswap.c b/hw/dmx/glxProxy/g_renderswap.c
index e675696..e434a71 100644
--- a/hw/dmx/glxProxy/g_renderswap.c
+++ b/hw/dmx/glxProxy/g_renderswap.c
@@ -32,6 +32,7 @@
 #include "glxext.h"
 #include "g_disptab.h"
 #include "unpack.h"
+#include "compsize.h"
 
 void __glXDispSwap_CallList(GLbyte *pc)
 {
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index a76201d..fb4bce8 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -52,6 +52,8 @@
 #include "glxvisuals.h"
 #include "glxswap.h"
 
+#include "glxcmds.h"
+
 #ifdef PANORAMIX
 #include "panoramiXsrv.h"
 #endif
diff --git a/hw/dmx/glxProxy/glxcmds.h b/hw/dmx/glxProxy/glxcmds.h
new file mode 100644
index 0000000..ae866be
--- /dev/null
+++ b/hw/dmx/glxProxy/glxcmds.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2011 Apple Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __GLX_cmds_h__
+#define __GLX_cmds_h__
+
+extern int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc);
+extern int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
+extern int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc);
+extern int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc);
+extern int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc);
+
+#endif /* !__GLX_cmds_h__ */
diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index 2294059..f28a79d 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -35,11 +35,14 @@
 #include <pixmapstr.h>
 #include <windowstr.h>
 #include "unpack.h"
+#include "glxcmds.h"
 #include "glxext.h"
 #include "glxvendor.h"
 
 extern int glxIsExtensionSupported( char *ext );
 
+int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+
 /************************************************************************/
 
 /*
commit 632d205b309d0515b4ae0f9902059aa4b093a313
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Nov 7 20:24:08 2011 -0800

    Fix gcc -Wwrite-strings warnings in xf86Modes code
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 9532151..da9db34 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -481,7 +481,7 @@ static void
 xf86OutputSetMonitor (xf86OutputPtr output)
 {
     char    *option_name;
-    char    *monitor;
+    const char    *monitor;
 
     if (!output->name)
 	return;
@@ -561,7 +561,7 @@ xf86OutputIgnored (xf86OutputPtr    output)
     return xf86ReturnOptValBool (output->options, OPTION_IGNORE, FALSE);
 }
 
-static char *direction[4] = {
+static const char *direction[4] = {
     "normal", 
     "left", 
     "inverted", 
@@ -3063,13 +3063,13 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
     return mon;
 }
 
-static char *_xf86ConnectorNames[] = {
+static const char *_xf86ConnectorNames[] = {
 					"None", "VGA", "DVI-I", "DVI-D",
 					"DVI-A", "Composite", "S-Video",
 					"Component", "LFP", "Proprietary",
 					"HDMI", "DisplayPort",
 				     };
-char *
+const char *
 xf86ConnectorGetName(xf86ConnectorType connector)
 {
     return _xf86ConnectorNames[connector];
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 716499f..8d4a089 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -900,7 +900,7 @@ xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
 /*
  * Get a standard string name for a connector type 
  */
-extern _X_EXPORT char *
+extern _X_EXPORT const char *
 xf86ConnectorGetName(xf86ConnectorType connector);
 
 /*
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 86065f8..0100d2a 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -230,7 +230,7 @@ static Bool quirk_dvi_single_link(int scrnIndex, xf86MonPtr DDC)
 typedef struct {
     Bool	(*detect) (int scrnIndex, xf86MonPtr DDC);
     ddc_quirk_t	quirk;
-    char	*description;
+    const char	*description;
 } ddc_quirk_map_t;
 
 static const ddc_quirk_map_t ddc_quirks[] = {
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index dcd3a28..49cc149 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -272,7 +272,7 @@ xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2)
 }
 
 static void
-add(char **p, char *new)
+add(char **p, const char *new)
 {
     *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
     strcat(*p, " ");
@@ -599,7 +599,7 @@ xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
 
 	if (mode->status != MODE_OK) {
 	    if (verbose) {
-		char *type = "";
+		const char *type = "";
 		if (mode->type & M_T_BUILTIN)
 		    type = "built-in ";
 		else if (mode->type & M_T_DEFAULT)
commit 09e4b78f7944234865f4648940453303af0c2663
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Nov 7 19:19:47 2011 -0800

    Fix gcc -Wwrite-strings warnings in xf86 ddx
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index cc79973..228021b 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -248,9 +248,9 @@ xf86ModulelistFromConfig(pointer **optlist)
 {
     int count = 0, i = 0;
     char **modulearray;
-    char *ignore[] = { "GLcore", "speedo", "bitmap", "drm",
-		       "freetype", "type1",
-		       NULL };
+    const char *ignore[] = { "GLcore", "speedo", "bitmap", "drm",
+                             "freetype", "type1",
+                             NULL };
     pointer *optarray;
     XF86LoadPtr modp;
     Bool found;
@@ -522,7 +522,7 @@ fixup_video_driver_list(char **drivers)
 }
 
 static char **
-GenerateDriverlist(char * dirname)
+GenerateDriverlist(const char * dirname)
 {
     char **ret;
     const char *subdirs[] = { dirname, NULL };
@@ -553,7 +553,7 @@ xf86DriverlistFromCompile(void)
  *      available is printed.
  */
 static void
-xf86ConfigError(char *msg, ...)
+xf86ConfigError(const char *msg, ...)
 {
     va_list ap;
 
@@ -2301,7 +2301,7 @@ ConfigStatus
 xf86HandleConfigFile(Bool autoconfig)
 {
     const char *filename, *dirname, *sysdirname;
-    char *filesearch, *dirsearch;
+    const char *filesearch, *dirsearch;
     MessageType filefrom = X_DEFAULT;
     MessageType dirfrom = X_DEFAULT;
     char *scanptr;
diff --git a/hw/xfree86/common/xf86Config.h b/hw/xfree86/common/xf86Config.h
index de28704..411fc2c 100644
--- a/hw/xfree86/common/xf86Config.h
+++ b/hw/xfree86/common/xf86Config.h
@@ -51,7 +51,7 @@ typedef enum _ConfigStatus {
 } ConfigStatus;
 
 typedef struct _ModuleDefault {
-    char *name;
+    const char *name;
     Bool toLoad;
     XF86OptionPtr load_opt;
 } ModuleDefault;
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 61e89ed..24f367e 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -58,17 +58,17 @@ Bool xf86DoConfigurePass1 = TRUE;
 static Bool foundMouse = FALSE;
 
 #if   defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-static char *DFLT_MOUSE_DEV = "/dev/sysmouse";
-static char *DFLT_MOUSE_PROTO = "auto";
+static const char *DFLT_MOUSE_DEV = "/dev/sysmouse";
+static const char *DFLT_MOUSE_PROTO = "auto";
 #elif defined(linux)
-static char DFLT_MOUSE_DEV[] = "/dev/input/mice";
-static char DFLT_MOUSE_PROTO[] = "auto";
+static const char *DFLT_MOUSE_DEV = "/dev/input/mice";
+static const char *DFLT_MOUSE_PROTO = "auto";
 #elif defined(WSCONS_SUPPORT)
-static char *DFLT_MOUSE_DEV = "/dev/wsmouse";
-static char *DFLT_MOUSE_PROTO = "wsmouse";
+static const char *DFLT_MOUSE_DEV = "/dev/wsmouse";
+static const char *DFLT_MOUSE_PROTO = "wsmouse";
 #else
-static char *DFLT_MOUSE_DEV = "/dev/mouse";
-static char *DFLT_MOUSE_PROTO = "auto";
+static const char *DFLT_MOUSE_DEV = "/dev/mouse";
+static const char *DFLT_MOUSE_PROTO = "auto";
 #endif
 
 /*
@@ -516,9 +516,9 @@ void
 DoConfigure(void)
 {
     int i,j, screennum = -1;
-    char *home = NULL;
+    const char *home = NULL;
     char filename[PATH_MAX];
-    char *addslash = "";
+    const char *addslash = "";
     XF86ConfigPtr xf86config = NULL;
     char **vlist, **vl;
     int *dev2screen;
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index f467996..d576fb9 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -163,7 +163,7 @@ const char *xf86VisualNames[] = {
 };
 
 /* Parameters set only from the command line */
-char *xf86ServerName = "no-name";
+const char *xf86ServerName = "no-name";
 Bool xf86fpFlag = FALSE;
 Bool xf86sFlag = FALSE;
 Bool xf86bsEnableFlag = FALSE;
diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 644e5ce..d202d40 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -96,7 +96,7 @@
 static void
 printModeRejectMessage(int index, DisplayModePtr p, int status)
 {
-    char *type;
+    const char *type;
 
     if (p->type & M_T_BUILTIN)
 	type = "built-in ";
@@ -2065,7 +2065,7 @@ xf86PrintModes(ScrnInfoPtr scrp)
 {
     DisplayModePtr p;
     float hsync, refresh = 0;
-    char *desc, *desc2, *prefix, *uprefix;
+    const char *desc, *desc2, *prefix, *uprefix;
 
     if (scrp == NULL)
 	return;
diff --git a/hw/xfree86/common/xf86Opt.h b/hw/xfree86/common/xf86Opt.h
index 88392dc..b0fdaa6 100644
--- a/hw/xfree86/common/xf86Opt.h
+++ b/hw/xfree86/common/xf86Opt.h
@@ -72,7 +72,7 @@ typedef struct {
 
 extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt);
 extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt);
-extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
+extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt);
 extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name, int deflt );
 extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list, const char *name, double deflt );
 extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt);
@@ -91,7 +91,7 @@ extern _X_EXPORT char *xf86OptionName(XF86OptionPtr opt);
 extern _X_EXPORT char *xf86OptionValue(XF86OptionPtr opt);
 extern _X_EXPORT void xf86OptionListReport(XF86OptionPtr parm);
 extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name);
-extern _X_EXPORT char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
+extern _X_EXPORT const char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
 extern _X_EXPORT void xf86MarkOptionUsed(XF86OptionPtr option);
 extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name);
 extern _X_EXPORT Bool xf86CheckIfOptionUsed(XF86OptionPtr option);
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index d1d74f5..dc0a018 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -187,7 +187,7 @@ LookupRealOption(XF86OptionPtr optlist, const char *name, double deflt,
 
 
 static char *
-LookupStrOption(XF86OptionPtr optlist, const char *name, char *deflt, Bool markUsed)
+LookupStrOption(XF86OptionPtr optlist, const char *name, const char *deflt, Bool markUsed)
 {
     OptionInfoRec o;
 
@@ -243,7 +243,7 @@ xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt)
 
 
 char *
-xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
+xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt)
 {
     return LookupStrOption(optlist, name, deflt, TRUE);
 }
@@ -416,7 +416,7 @@ xf86FindOption(XF86OptionPtr options, const char *name)
 }
 
 
-char *
+const char *
 xf86FindOptionValue(XF86OptionPtr options, const char *name)
 {
     return xf86findOptionValue(options, name);
diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c
index 16b6bdc..47e0297 100644
--- a/hw/xfree86/common/xf86PM.c
+++ b/hw/xfree86/common/xf86PM.c
@@ -41,7 +41,7 @@ pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event) = NULL;
 static Bool suspended = FALSE;
 
 static int
-eventName(pmEvent event, char **str)
+eventName(pmEvent event, const char **str)
 {
     switch(event) {
     case XF86_APM_SYS_STANDBY: *str="System Standby Request"; return 0;
@@ -179,7 +179,7 @@ xf86HandlePMEvents(int fd, pointer data)
     if ((n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS))) {
 	do {
 	    for (i = 0; i < n; i++) {
-		char *str = NULL;
+		const char *str = NULL;
 		int verb = eventName(events[i],&str);
 
 		xf86MsgVerb(X_INFO,verb,"PM Event received: %s\n",str);
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 1fe3d7e..8c69859 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -69,7 +69,7 @@ extern _X_EXPORT  Pix24Flags xf86Pix24;
 extern _X_EXPORT  rgb xf86Weight;
 extern _X_EXPORT  Bool xf86FlipPixels;
 extern _X_EXPORT  Gamma xf86Gamma;
-extern _X_EXPORT  char *xf86ServerName;
+extern _X_EXPORT  const char *xf86ServerName;
 
 /* Other parameters */
 
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index b3d3b9e..b95b253 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1062,7 +1062,7 @@ videoPtrToDriverList(struct pci_device *dev,
     int i;
     /* Add more entries here if we ever return more than 4 drivers for
        any device */
-    char *driverList[5] = { NULL, NULL, NULL, NULL, NULL };
+    const char *driverList[5] = { NULL, NULL, NULL, NULL, NULL };
 
     switch (dev->vendor_id)
     {
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index a1212a6..ca5efc9 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -3187,7 +3187,7 @@ would not need to use these directly.
 
     <blockquote><para>
 	<programlisting>
-    char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
+    const char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
 	</programlisting>
 	<blockquote><para>
       Takes a list of options and an option name, and returns the value
diff --git a/hw/xfree86/i2c/msp3430.c b/hw/xfree86/i2c/msp3430.c
index 2f244e4..df8adc4 100644
--- a/hw/xfree86/i2c/msp3430.c
+++ b/hw/xfree86/i2c/msp3430.c
@@ -20,7 +20,7 @@
 void InitMSP34xxG(MSP3430Ptr m);
 void InitMSP34x5D(MSP3430Ptr m);
 void CheckModeMSP34x5D(MSP3430Ptr m);
-char *MSP_getProductName (CARD16 product_id);
+static const char *MSP_getProductName (CARD16 product_id);
 void mpause(int milliseconds);
 
 #define __MSPDEBUG__	0
@@ -305,7 +305,8 @@ void MSP3430SetSource(MSP3430Ptr m, CARD8 value)
 #endif
 
 
-char *MSP_getProductName (CARD16 product_id)
+static const char *
+MSP_getProductName (CARD16 product_id)
 {
 	switch (product_id) {
 		case 0x0400: return "MSP3400D";
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index f0a6170..87fd3ed 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -330,7 +330,7 @@ xf86findOption (XF86OptionPtr list, const char *name)
  * returned.  If the option is not found, a NULL is returned.
  */
 
-char *
+const char *
 xf86findOptionValue (XF86OptionPtr list, const char *name)
 {
 	XF86OptionPtr p = xf86findOption (list, name);
diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h
index 7d8a8e5..114cdfe 100644
--- a/hw/xfree86/parser/configProcs.h
+++ b/hw/xfree86/parser/configProcs.h
@@ -95,9 +95,9 @@ int xf86getSubToken(char **comment);
 int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab);
 void xf86unGetToken(int token);
 char *xf86tokenString(void);
-void xf86parseError(char *format, ...);
-void xf86validationError(char *format, ...);
-void xf86setSection(char *section);
+void xf86parseError(const char *format, ...);
+void xf86validationError(const char *format, ...);
+void xf86setSection(const char *section);
 int xf86getStringToken(xf86ConfigSymTabRec *tab);
 /* write.c */
 /* DRI.c */
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 8470789..e25b1ad 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -90,7 +90,7 @@
 #define CONFIG_BUF_LEN     1024
 #define CONFIG_MAX_FILES   64
 
-static int StringToToken (char *, xf86ConfigSymTabRec *);
+static int StringToToken (const char *, xf86ConfigSymTabRec *);
 
 static struct {
 	FILE *file;
@@ -992,11 +992,11 @@ xf86setBuiltinConfig(const char *config[])
 }
 
 void
-xf86parseError (char *format,...)
+xf86parseError (const char *format,...)
 {
 	va_list ap;
-	char *filename = numFiles ? configFiles[curFileIndex].path :
-			 "<builtin configuration>";
+	const char *filename = numFiles ? configFiles[curFileIndex].path
+					: "<builtin configuration>";
 
 	ErrorF ("Parse error on line %d of section %s in file %s\n\t",
 		 configLineNo, configSection, filename);
@@ -1008,11 +1008,11 @@ xf86parseError (char *format,...)
 }
 
 void
-xf86validationError (char *format,...)
+xf86validationError (const char *format,...)
 {
 	va_list ap;
-	char *filename = numFiles ? configFiles[curFileIndex].path :
-			 "<builtin configuration>";
+	const char *filename = numFiles ? configFiles[curFileIndex].path
+					: "<builtin configuration>";
 
 	ErrorF ("Data incomplete in file %s\n\t", filename);
 	va_start (ap, format);
@@ -1023,7 +1023,7 @@ xf86validationError (char *format,...)
 }
 
 void
-xf86setSection (char *section)
+xf86setSection (const char *section)
 {
 	free(configSection);
 	configSection = strdup(section);
@@ -1040,7 +1040,7 @@ xf86getStringToken (xf86ConfigSymTabRec * tab)
 }
 
 static int
-StringToToken (char *str, xf86ConfigSymTabRec * tab)
+StringToToken (const char *str, xf86ConfigSymTabRec * tab)
 {
 	int i;
 
diff --git a/hw/xfree86/parser/xf86Optrec.h b/hw/xfree86/parser/xf86Optrec.h
index 61a8c5f..b8e9d61 100644
--- a/hw/xfree86/parser/xf86Optrec.h
+++ b/hw/xfree86/parser/xf86Optrec.h
@@ -77,7 +77,7 @@ extern _X_EXPORT char *xf86optionValue(XF86OptionPtr opt);
 extern _X_EXPORT XF86OptionPtr xf86newOption(char *name, char *value);
 extern _X_EXPORT XF86OptionPtr xf86nextOption(XF86OptionPtr list);
 extern _X_EXPORT XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name);
-extern _X_EXPORT char *xf86findOptionValue(XF86OptionPtr list, const char *name);
+extern _X_EXPORT const char *xf86findOptionValue(XF86OptionPtr list, const char *name);
 extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options, int count, int used);
 extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
 extern _X_EXPORT int xf86nameCompare (const char *s1, const char *s2);
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index a8785c5..c12bd56 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -479,7 +479,7 @@ XF86ConfigRec, *XF86ConfigPtr;
 typedef struct
 {
 	int token;			/* id of the token */
-	char *name;			/* pointer to the LOWERCASED name */
+	const char *name;		/* pointer to the LOWERCASED name */
 }
 xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
 
diff --git a/hw/xfree86/ramdac/BTPriv.h b/hw/xfree86/ramdac/BTPriv.h
index 184b481..5273776 100644
--- a/hw/xfree86/ramdac/BTPriv.h
+++ b/hw/xfree86/ramdac/BTPriv.h
@@ -6,7 +6,7 @@
 #include "BT.h"
 
 typedef struct {
-	char *DeviceName;
+	const char *DeviceName;
 } xf86BTramdacInfo;
 
 extern xf86BTramdacInfo BTramdacDeviceInfo[];
diff --git a/hw/xfree86/ramdac/IBMPriv.h b/hw/xfree86/ramdac/IBMPriv.h
index a33da91..309a193 100644
--- a/hw/xfree86/ramdac/IBMPriv.h
+++ b/hw/xfree86/ramdac/IBMPriv.h
@@ -6,7 +6,7 @@
 #include "IBM.h"
 
 typedef struct {
-	char *DeviceName;
+	const char *DeviceName;
 } xf86IBMramdacInfo;
 
 extern xf86IBMramdacInfo IBMramdacDeviceInfo[];
diff --git a/hw/xfree86/ramdac/TIPriv.h b/hw/xfree86/ramdac/TIPriv.h
index 191c9b5..20e07f5 100644
--- a/hw/xfree86/ramdac/TIPriv.h
+++ b/hw/xfree86/ramdac/TIPriv.h
@@ -6,7 +6,7 @@
 #include "TI.h"
 
 typedef struct {
-	char *DeviceName;
+	const char *DeviceName;
 } xf86TIramdacInfo;
 
 extern xf86TIramdacInfo TIramdacDeviceInfo[];
diff --git a/hw/xfree86/utils/gtf/gtf.c b/hw/xfree86/utils/gtf/gtf.c
index bd5de7d..87fcb3f 100644
--- a/hw/xfree86/utils/gtf/gtf.c
+++ b/hw/xfree86/utils/gtf/gtf.c
@@ -151,7 +151,7 @@ typedef struct __options
 
 /* prototypes */
 
-void print_value(int n, char *name, float val);
+void print_value(int n, const char *name, float val);
 void print_xf86_mode (mode *m);
 void print_fb_mode (mode *m);
 mode *vert_refresh (int h_pixels, int v_lines, float freq,
@@ -168,7 +168,7 @@ options *parse_command_line (int argc, char *argv[]);
 
 int global_verbose = 0;
 
-void print_value(int n, char *name, float val)
+void print_value(int n, const char *name, float val)
 {
     if (global_verbose) {
         printf("%2d: %-27s: %15f\n", n, name, val);
diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c
index 06a6284..6ecca68 100644
--- a/hw/xfree86/vbe/vbe.c
+++ b/hw/xfree86/vbe/vbe.c
@@ -170,7 +170,7 @@ vbeFree(vbeInfoPtr pVbe)
 static Bool
 vbeProbeDDC(vbeInfoPtr pVbe)
 {
-    char *ddc_level;
+    const char *ddc_level;
     int screen = pVbe->pInt10->scrnIndex;
     
     if (pVbe->ddc == DDC_NONE)
commit 8e4556f560487f3d07812834d4785441d0a8323c
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Nov 7 20:09:47 2011 -0800

    FindModule: stop copying const char *dirname to char *dirpath
    
    Not needed since 6cf844ab69926b split out the allocation/manipulation
    into the helper function, leaving FindModule just copying the pointer
    around, and causing gcc warnings and an unreachable call to free.
    
    Also no longer need to store the combined strlen results in dirlen.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index a21f43d6..c697d74 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -437,14 +437,11 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
 	   PatternPtr patterns)
 {
     char buf[PATH_MAX + 1];
-    char *dirpath = NULL;
     char *name = NULL;
-    int dirlen;
     const char **subdirs = NULL;
     const char **s;
 
-    dirpath = (char *)dirname;
-    if (strlen(dirpath) > PATH_MAX)
+    if (strlen(dirname) > PATH_MAX)
 	return NULL;
     
     subdirs = InitSubdirs(subdirlist);
@@ -452,17 +449,15 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
 	return NULL;
 
     for (s = subdirs; *s; s++) {
-	if ((dirlen = strlen(dirpath) + strlen(*s)) > PATH_MAX)
+	if ((strlen(dirname) + strlen(*s)) > PATH_MAX)
 	    continue;
-	strcpy(buf, dirpath);
+	strcpy(buf, dirname);
 	strcat(buf, *s);
         if ((name = FindModuleInSubdir(buf, module)))
             break;
     }
 
     FreeSubdirs(subdirs);
-    if (dirpath != dirname)
-	free(dirpath);
 
     return name;
 }
commit 05f589d464a961aea8d25632a390fb66a06cd186
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Nov 4 23:21:34 2011 -0700

    Fix gcc -Wwrite-strings warnings in various extensions
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/Xext/security.c b/Xext/security.c
index 08d8158..0a63aa2 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -62,7 +62,7 @@ typedef struct {
 } SecurityStateRec;
 
 /* Extensions that untrusted clients shouldn't have access to */
-static char *SecurityTrustedExtensions[] = {
+static const char *SecurityTrustedExtensions[] = {
     "XC-MISC",
     "BIG-REQUESTS",
     "XpExtension",
@@ -98,7 +98,7 @@ static const Mask SecurityClientMask = DixGetAttrAccess;
  */
 
 static void
-SecurityAudit(char *format, ...)
+SecurityAudit(const char *format, ...)
 {
     va_list args;
 
diff --git a/Xext/sync.c b/Xext/sync.c
index 3b257f7..23360f0 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -971,7 +971,7 @@ static int FreeCounter(void *, XID);
 
 pointer
 SyncCreateSystemCounter(
-	char *name,
+	const char *name,
 	CARD64 initial,
 	CARD64 resolution,
 	SyncCounterType counterType,
@@ -1308,7 +1308,7 @@ ProcSyncListSystemCounters(ClientPtr client)
 
     for (i = len = 0; i < SyncNumSystemCounters; i++)
     {
-	char *name = SysCounterList[i]->pSysCounterInfo->name;
+	const char *name = SysCounterList[i]->pSysCounterInfo->name;
 	/* pad to 4 byte boundary */
 	len += pad_to_int32(sz_xSyncSystemCounter + strlen(name));
     }
diff --git a/Xext/syncsrv.h b/Xext/syncsrv.h
index 7ca1fba..2b70773 100644
--- a/Xext/syncsrv.h
+++ b/Xext/syncsrv.h
@@ -66,7 +66,7 @@ typedef enum {
 } SyncCounterType;
 
 typedef struct _SysCounterInfo {
-    char	*name;
+    const char	*name;
     CARD64	resolution;
     CARD64	bracket_greater;
     CARD64	bracket_less;
@@ -118,7 +118,7 @@ typedef union {
 } SyncAwaitUnion;
 
 extern pointer SyncCreateSystemCounter(
-    char *	/* name */,
+    const char */* name */,
     CARD64  	/* inital_value */,
     CARD64  	/* resolution */,
     SyncCounterType /* change characterization */,
diff --git a/Xext/xtest.c b/Xext/xtest.c
index b69de35..bd8e1d3 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -603,7 +603,7 @@ DeviceSetXTestProperty(DeviceIntPtr dev, Atom property,
  * This only creates the pair, Activate/Enable Device
  * still need to be called.
  */
-int AllocXTestDevice (ClientPtr client, char* name,
+int AllocXTestDevice (ClientPtr client, const char* name,
                      DeviceIntPtr* ptr, DeviceIntPtr* keybd,
                      DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
 {
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 7724f5f..a2c807b 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -162,7 +162,7 @@ Mask ExtExclusiveMasks[EMASKSIZE];
 static struct dev_type
 {
     Atom type;
-    char *name;
+    const char *name;
 } dev_type[] = {
     {
     0, XI_KEYBOARD}, {
@@ -1127,7 +1127,7 @@ IResetProc(ExtensionEntry * unused)
  */
 
 void
-AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
+AssignTypeAndName(DeviceIntPtr dev, Atom type, const char *name)
 {
     dev->xinput_type = type;
     dev->name = strdup(name);
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index f726030..88de119 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -48,7 +48,7 @@
 static struct dev_properties
 {
     Atom type;
-    char *name;
+    const char *name;
 } dev_properties[] = {
     {0, XI_PROP_ENABLED},
     {0, XI_PROP_XTEST_DEVICE},
diff --git a/dix/devices.c b/dix/devices.c
index da817a8..37cbcdb 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2554,7 +2554,7 @@ GetMaster(DeviceIntPtr dev, int which)
  * the value for master.
  */
 int
-AllocDevicePair (ClientPtr client, char* name,
+AllocDevicePair (ClientPtr client, const char* name,
                  DeviceIntPtr* ptr,
                  DeviceIntPtr* keybd,
                  DeviceProc ptr_proc,
diff --git a/dix/extension.c b/dix/extension.c
index c7bbac5..53aaf05 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -71,7 +71,7 @@ static int lastError = FirstExtensionError;
 static unsigned int NumExtensions = 0;
 
 ExtensionEntry *
-AddExtension(char *name, int NumEvents, int NumErrors, 
+AddExtension(const char *name, int NumEvents, int NumErrors,
 	     int (*MainProc)(ClientPtr c1), 
 	     int (*SwappedMainProc)(ClientPtr c2), 
 	     void (*CloseDownProc)(ExtensionEntry *e), 
@@ -151,7 +151,7 @@ AddExtension(char *name, int NumEvents, int NumErrors,
     return ext;
 }
 
-Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
+Bool AddExtensionAlias(const char *alias, ExtensionEntry *ext)
 {
     char *name;
     char **aliases;
@@ -172,7 +172,7 @@ Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
 }
 
 static int
-FindExtension(char *extname, int len)
+FindExtension(const char *extname, int len)
 {
     int i, j;
 
@@ -201,7 +201,7 @@ CheckExtension(const char *extname)
 {
     int n;
 
-    n = FindExtension((char*)extname, strlen(extname));
+    n = FindExtension(extname, strlen(extname));
     if (n != -1)
 	return extensions[n];
     else
diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index 5c481c9..2b11828 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -565,7 +565,7 @@ should be called by InitExtensions.
 	ExtensionEntry *AddExtension(name, NumEvents,NumErrors,
 		MainProc, SwappedMainProc, CloseDownProc, MinorOpcodeProc)
 
-		char *name;  /*Null terminate string; case matters*/
+		const char *name;  /*Null terminate string; case matters*/
 		int NumEvents;
 		int NumErrors;
 		int (* MainProc)(ClientPtr);/*Called if client matches server order*/
diff --git a/include/extension.h b/include/extension.h
index 29a11c3..ee6260e 100644
--- a/include/extension.h
+++ b/include/extension.h
@@ -54,9 +54,9 @@ extern _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr /*client*/);
 
 extern _X_EXPORT unsigned short MinorOpcodeOfRequest(ClientPtr /*client*/);
 
-extern _X_EXPORT Bool EnableDisableExtension(char *name, Bool enable);
+extern _X_EXPORT Bool EnableDisableExtension(const char *name, Bool enable);
 
-extern _X_EXPORT void EnableDisableExtensionError(char *name, Bool enable);
+extern _X_EXPORT void EnableDisableExtensionError(const char *name, Bool enable);
 
 extern _X_EXPORT void InitExtensions(int argc, char **argv);
 
diff --git a/include/extinit.h b/include/extinit.h
index c3aa7b6..8e47beb 100644
--- a/include/extinit.h
+++ b/include/extinit.h
@@ -41,7 +41,7 @@ extern _X_EXPORT void
 AssignTypeAndName (
 	DeviceIntPtr           /* dev */,
 	Atom                   /* type */,
-	char *                 /* name */
+	const char *           /* name */
 	);
 
 #endif /* EXTINIT_H */
diff --git a/include/extnsionst.h b/include/extnsionst.h
index bb66dfb..aeefa99 100644
--- a/include/extnsionst.h
+++ b/include/extnsionst.h
@@ -92,7 +92,7 @@ extern _X_EXPORT void NotImplemented (	/* FIXME: this may move to another file..
 #define    GetGCValue(pGC, GCElement)    (pGC->GCElement)
 
 extern _X_EXPORT ExtensionEntry *AddExtension(
-    char* /*name*/,
+    const char* /*name*/,
     int /*NumEvents*/,
     int /*NumErrors*/,
     int (* /*MainProc*/)(ClientPtr /*client*/),
@@ -102,7 +102,7 @@ extern _X_EXPORT ExtensionEntry *AddExtension(
 );
 
 extern _X_EXPORT Bool AddExtensionAlias(
-    char* /*alias*/,
+    const char* /*alias*/,
     ExtensionEntry * /*extension*/);
 
 extern _X_EXPORT ExtensionEntry *CheckExtension(const char *extname);
diff --git a/include/input.h b/include/input.h
index 9ef726f..87bb2aa 100644
--- a/include/input.h
+++ b/include/input.h
@@ -505,7 +505,7 @@ extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
 extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
 
 extern _X_EXPORT int AllocDevicePair(ClientPtr client,
-                             char* name,
+                             const char* name,
                              DeviceIntPtr* ptr,
                              DeviceIntPtr* keybd,
                              DeviceProc ptr_proc,
@@ -521,7 +521,7 @@ extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
 extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
                          int max_keys_per_mod);
 extern int AllocXTestDevice(ClientPtr client,
-                             char* name,
+                             const char* name,
                              DeviceIntPtr* ptr,
                              DeviceIntPtr* keybd,
                              DeviceIntPtr master_ptr,
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 4499f37..8836992 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -268,7 +268,7 @@ extern void GEExtensionInit(INITARGS);
  * configurable extensions.
  */
 typedef struct {
-    char *name;
+    const char *name;
     Bool *disablePtr;
 } ExtensionToggle;
 
@@ -337,7 +337,7 @@ static ExtensionToggle ExtensionToggleList[] =
     { NULL, NULL }
 };
 
-Bool EnableDisableExtension(char *name, Bool enable)
+Bool EnableDisableExtension(const char *name, Bool enable)
 {
     ExtensionToggle *ext = &ExtensionToggleList[0];
 
@@ -357,7 +357,7 @@ Bool EnableDisableExtension(char *name, Bool enable)
     return FALSE;
 }
 
-void EnableDisableExtensionError(char *name, Bool enable)
+void EnableDisableExtensionError(const char *name, Bool enable)
 {
     ExtensionToggle *ext = &ExtensionToggleList[0];
     Bool found = FALSE;
diff --git a/render/filter.c b/render/filter.c
index 8bb6d5e..0cbd47b 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -47,7 +47,7 @@ static int  nfilterNames;
  */
 
 int
-PictureGetFilterId (char *filter, int len, Bool makeit)
+PictureGetFilterId (const char *filter, int len, Bool makeit)
 {
     int	    i;
     char    *name;
@@ -125,7 +125,7 @@ PictureFreeFilterIds (void)
 
 int
 PictureAddFilter (ScreenPtr			    pScreen,
-		  char				    *filter,
+		  const char			    *filter,
 		  PictFilterValidateParamsProcPtr   ValidateParams,
 		  int				    width,
 		  int				    height)
@@ -160,7 +160,7 @@ PictureAddFilter (ScreenPtr			    pScreen,
 }
 
 Bool
-PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias)
+PictureSetFilterAlias (ScreenPtr pScreen, const char *filter, const char *alias)
 {
     PictureScreenPtr    ps = GetPictureScreen(pScreen);
     int			filter_id = PictureGetFilterId (filter, -1, FALSE);
diff --git a/render/picturestr.h b/render/picturestr.h
index 1f3f5a4..9b37671 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -433,20 +433,20 @@ extern _X_EXPORT Bool
 PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
 
 extern _X_EXPORT int
-PictureGetFilterId (char *filter, int len, Bool makeit);
+PictureGetFilterId (const char *filter, int len, Bool makeit);
 
 extern _X_EXPORT char *
 PictureGetFilterName (int id);
 
 extern _X_EXPORT int
 PictureAddFilter (ScreenPtr			    pScreen,
-		  char				    *filter,
+		  const char			    *filter,
 		  PictFilterValidateParamsProcPtr   ValidateParams,
 		  int				    width,
 		  int				    height);
 
 extern _X_EXPORT Bool
-PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias);
+PictureSetFilterAlias (ScreenPtr pScreen, const char *filter, const char *alias);
 
 extern _X_EXPORT Bool
 PictureSetDefaultFilters (ScreenPtr pScreen);
commit 232f1ddf3d060f3ce9d2ebd35f33b1294cac380e
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Nov 3 21:21:19 2011 -0700

    Fix gcc -Wwrite-strings warnings in XkbGetRulesDflts
    
    Stop temporarily storing a pointer to a constant literal string
    in a char *, just to strdup it a few lines later.
    
    Fixes gcc -Wwrite-strings warnings:
    
    xkbInit.c: In function 'XkbGetRulesDflts':
    xkbInit.c:121:38: warning: assignment discards qualifiers from pointer target type
    xkbInit.c:123:23: warning: assignment discards qualifiers from pointer target type
    xkbInit.c:125:24: warning: assignment discards qualifiers from pointer target type
    xkbInit.c:127:25: warning: assignment discards qualifiers from pointer target type
    xkbInit.c:129:25: warning: assignment discards qualifiers from pointer target type
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 1ec4e55..f578f16 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -117,22 +117,11 @@ static Bool		XkbWantRulesProp=	XKB_DFLT_RULES_PROP;
 void
 XkbGetRulesDflts(XkbRMLVOSet *rmlvo)
 {
-    if (XkbRulesDflt)   rmlvo->rules = XkbRulesDflt;
-    else                rmlvo->rules = XKB_DFLT_RULES;
-    if (XkbModelDflt)	rmlvo->model= XkbModelDflt;
-    else		rmlvo->model= XKB_DFLT_MODEL;
-    if (XkbLayoutDflt)	rmlvo->layout= XkbLayoutDflt;
-    else		rmlvo->layout= XKB_DFLT_LAYOUT;
-    if (XkbVariantDflt)	rmlvo->variant= XkbVariantDflt;
-    else		rmlvo->variant= XKB_DFLT_VARIANT;
-    if (XkbOptionsDflt)	rmlvo->options= XkbOptionsDflt;
-    else		rmlvo->options= XKB_DFLT_OPTIONS;
-
-    rmlvo->rules = strdup(rmlvo->rules);
-    rmlvo->model = strdup(rmlvo->model);
-    rmlvo->layout = strdup(rmlvo->layout);
-    rmlvo->variant = strdup(rmlvo->variant);
-    rmlvo->options = strdup(rmlvo->options);
+    rmlvo->rules  = strdup(XkbRulesDflt   ? XkbRulesDflt   : XKB_DFLT_RULES);
+    rmlvo->model  = strdup(XkbModelDflt   ? XkbModelDflt   : XKB_DFLT_MODEL);
+    rmlvo->layout = strdup(XkbLayoutDflt  ? XkbLayoutDflt  : XKB_DFLT_LAYOUT);
+    rmlvo->variant= strdup(XkbVariantDflt ? XkbVariantDflt : XKB_DFLT_VARIANT);
+    rmlvo->options= strdup(XkbOptionsDflt ? XkbOptionsDflt : XKB_DFLT_OPTIONS);
 }
 
 void
commit 0bc41d5f8d1a6192f57d9bf646cc46ed839b06b9
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Nov 7 18:08:21 2011 -0800

    Remove redundant redeclarations of functions in the same header file
    
    Exposed by recent addition of -Wredundant-decls to default CWARNFLAGS
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h
index af3ba06..16a8641 100644
--- a/hw/xfree86/ddc/xf86DDC.h
+++ b/hw/xfree86/ddc/xf86DDC.h
@@ -100,11 +100,6 @@ typedef enum {
     DDC_QUIRK_DVI_SINGLE_LINK = 1 << 8,
 } ddc_quirk_t;
 
-DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
-
-extern Bool
-xf86MonitorIsHDMI(xf86MonPtr mon);
-
 typedef void (* handle_detailed_fn)(struct detailed_monitor_section *,void *);
 
 void xf86ForEachDetailedBlock(xf86MonPtr mon,
diff --git a/randr/randrstr.h b/randr/randrstr.h
index d8dd37d..842e0e0 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -462,9 +462,6 @@ extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
 extern _X_EXPORT RROutputPtr
 RRFirstOutput (ScreenPtr pScreen);
 
-extern _X_EXPORT Rotation
-RRGetRotation (ScreenPtr pScreen);
-
 extern _X_EXPORT CARD16
 RRVerticalRefresh (xRRModeInfo *mode);
 
@@ -500,8 +497,6 @@ RRSetCurrentConfig (ScreenPtr		pScreen,
 		    int			rate,
 		    RRScreenSizePtr	pSize);
 
-extern _X_EXPORT Bool RRScreenInit (ScreenPtr pScreen);
-
 extern _X_EXPORT Rotation
 RRGetRotation (ScreenPtr pScreen);
 
diff --git a/render/glyphstr.h b/render/glyphstr.h
index cc9f284..49b4b54 100644
--- a/render/glyphstr.h
+++ b/render/glyphstr.h
@@ -90,9 +90,6 @@ typedef struct _GlyphList {
     PictFormatPtr   format;
 } GlyphListRec, *GlyphListPtr;
 
-extern _X_EXPORT GlyphHashSetPtr
-FindGlyphHashSet (CARD32 filled);
-
 extern _X_EXPORT void
 GlyphUninit (ScreenPtr pScreen);
 
commit 285133a35eede03e37f41aeea6cbfd15a0800d98
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Nov 7 15:44:26 2011 -0800

    sun_agp: cast key to uintptr_t before casting to (int *)
    
    Matches what linux_agp already does and prevents gcc from throwing up:
    
    sun_agp.c: In function 'xf86DeallocateGARTMemory':
    sun_agp.c:236:40: error: cast to pointer from integer of different size
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xfree86/os-support/solaris/sun_agp.c b/hw/xfree86/os-support/solaris/sun_agp.c
index 0331ac1..8c4e9f5 100644
--- a/hw/xfree86/os-support/solaris/sun_agp.c
+++ b/hw/xfree86/os-support/solaris/sun_agp.c
@@ -233,7 +233,7 @@ xf86DeallocateGARTMemory(int screenNum, int key)
 	if (!GARTInit(screenNum) || (acquiredScreen != screenNum))
 		return FALSE;
 
- 	if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)key) != 0) {
+	if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)(uintptr_t)key) != 0) {
 		xf86DrvMsg(screenNum, X_WARNING, "xf86DeAllocateGARTMemory: "
 			   "deallocation of gart memory with key %d failed\n"
 			   "\t(%s)\n", key, strerror(errno));
commit f8dd5efb673439e7e9f7d82e6f9cfb97afacc85a
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Nov 3 21:18:56 2011 -0700

    Mark XKB char * as const to clean up gcc -Wwrite-strings warnings
    
    Cleans up around 120 warnings from this set
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/include/xkbfile.h b/include/xkbfile.h
index a4b99ee..db7dbfa 100644
--- a/include/xkbfile.h
+++ b/include/xkbfile.h
@@ -136,7 +136,7 @@ extern _X_EXPORT char *	XkbConfigText(
     unsigned 	/* format */
 );
 
-extern _X_EXPORT char *	XkbSIMatchText(
+extern _X_EXPORT const char *	XkbSIMatchText(
     unsigned	/* type */,
     unsigned	/* format */
 );
@@ -161,7 +161,7 @@ extern _X_EXPORT char *	XkbDoodadTypeText(
     unsigned	/* format */
 );
 
-extern _X_EXPORT char *	XkbActionTypeText(
+extern _X_EXPORT const char *	XkbActionTypeText(
     unsigned	/* type */,
     unsigned	/* format */
 );
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index c6f86f5..7b00534 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -296,8 +296,8 @@ extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer);
 extern _X_EXPORT int	XkbReqCode;
 extern _X_EXPORT int	XkbEventBase;
 extern _X_EXPORT int	XkbKeyboardErrorCode;
-extern _X_EXPORT char *	XkbBaseDirectory;
-extern _X_EXPORT char *	XkbBinDirectory;
+extern _X_EXPORT const char *	XkbBaseDirectory;
+extern _X_EXPORT const char *	XkbBinDirectory;
 
 extern _X_EXPORT CARD32	xkbDebugFlags;
 
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index e599f91..db34c8d 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -60,7 +60,7 @@ extern int Win32System(const char *cmdline);
 
 /***====================================================================***/
 
-static char *componentDirs[_XkbListNumComponents] = {
+static const char *componentDirs[_XkbListNumComponents] = {
 	"keycodes", "types", "compat", "symbols", "geometry"
 };
 
diff --git a/xkb/maprules.c b/xkb/maprules.c
index a14fbbb..6680047 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -200,7 +200,7 @@ Bool	endOfFile,spacePending,slashPending,inComment;
 #define	PART_MASK	0x000F
 #define	COMPONENT_MASK	0x03F0
 
-static	char *	cname[MAX_WORDS] = {
+static	const char *	cname[MAX_WORDS] = {
 	"model", "layout", "variant", "option", 
 	"keycodes", "symbols", "types", "compat", "geometry"
 };
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 3d3febb..1ec4e55 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -88,8 +88,8 @@ typedef struct	_SrvXkmInfo {
 #define	XKB_DFLT_RULES_PROP	TRUE
 #endif
 
-char	*		XkbBaseDirectory=	XKB_BASE_DIRECTORY;
-char	*		XkbBinDirectory=	XKB_BIN_DIRECTORY;
+const char *		XkbBaseDirectory=	XKB_BASE_DIRECTORY;
+const char *		XkbBinDirectory=	XKB_BIN_DIRECTORY;
 static int	 	XkbWantAccessX=		0;	
 
 static char *		XkbRulesDflt=		NULL;
diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c
index d8202b4..782b823 100644
--- a/xkb/xkbfmisc.c
+++ b/xkb/xkbfmisc.c
@@ -146,7 +146,7 @@ unsigned	set,rtrn;
 /***===================================================================***/
 
 static Bool
-XkbWriteSectionFromName(FILE *file,char *sectionName,char *name)
+XkbWriteSectionFromName(FILE *file,const char *sectionName,const char *name)
 {
     fprintf(file,"    xkb_%-20s { include \"%s\" };\n",sectionName,name);
     return TRUE;
diff --git a/xkb/xkbout.c b/xkb/xkbout.c
index 082c85e..889d5cc 100644
--- a/xkb/xkbout.c
+++ b/xkb/xkbout.c
@@ -108,7 +108,7 @@ XkbWriteXKBKeycodes(	FILE *			file,
 {
 Atom			kcName;
 register unsigned 	i;
-char *			alternate;
+const char *		alternate;
 
     if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) {
 	_XkbLibError(_XkbErrMissingNames,"XkbWriteXKBKeycodes",0);
@@ -133,7 +133,7 @@ char *			alternate;
     }
     if (xkb->indicators!=NULL) {
 	for (i=0;i<XkbNumIndicators;i++) {
-	    char *type;
+	    const char *type;
 	    if (xkb->indicators->phys_indicators&(1<<i))
 			type= "    ";
 	    else	type= "    virtual ";
@@ -395,7 +395,7 @@ Bool			showActions;
 	   						(showImplicit)) {
 		int 	typeNdx,g;
 		Bool	multi;
-		char *	comment="  ";
+		const char *	comment="  ";
 
 		if ((srv->explicit[i]&XkbExplicitKeyTypesMask)==0)
 		    comment= "//";
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index f31f53a..8ef2b05 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -215,7 +215,7 @@ char *str,buf[BUFFER_SIZE];
     return rtrn;
 }
 
-static char *modNames[XkbNumModifiers] = {
+static const char *modNames[XkbNumModifiers] = {
     "Shift", "Lock", "Control", "Mod1", "Mod2", "Mod3", "Mod4", "Mod5"
 };
 
@@ -367,15 +367,15 @@ char *buf;
 
 /***====================================================================***/
 
-static char *siMatchText[5] = {
+static const char *siMatchText[5] = {
 	"NoneOf", "AnyOfOrNone", "AnyOf", "AllOf", "Exactly"
 };
 
-char *
+const char *
 XkbSIMatchText(unsigned type,unsigned format)
 {
 static char buf[40];
-char *rtrn;
+const char *rtrn;
 
     switch (type&XkbSI_OpMask) {
 	case XkbSI_NoneOf:	rtrn= siMatchText[0]; break;
@@ -397,7 +397,7 @@ char *rtrn;
 
 /***====================================================================***/
 
-static char *imWhichNames[]= {
+static const char *imWhichNames[]= {
 	"base",
 	"latched",
 	"locked",
@@ -448,7 +448,7 @@ char *		buf;
     return buf;
 }
 
-static char *ctrlNames[] = {
+static const char *ctrlNames[] = {
 	"repeatKeys",
 	"slowKeys",
 	"bounceKeys",
@@ -616,7 +616,7 @@ char *	buf;
     return buf;
 }
 
-static char *actionTypeNames[XkbSA_NumActions]= {
+static const char *actionTypeNames[XkbSA_NumActions]= {
     "NoAction", 
     "SetMods",      "LatchMods",    "LockMods", 
     "SetGroup",     "LatchGroup",   "LockGroup",
@@ -631,11 +631,11 @@ static char *actionTypeNames[XkbSA_NumActions]= {
     "DeviceBtn",    "LockDeviceBtn"
 };
 
-char *
+const char *
 XkbActionTypeText(unsigned type,unsigned format)
 {
 static char buf[32];
-char *rtrn;
+const char *rtrn;
 
     if (type<=XkbSA_LastAction) {
 	rtrn= actionTypeNames[type];
@@ -652,7 +652,7 @@ char *rtrn;
 /***====================================================================***/
 
 static int
-TryCopyStr(char *to,char *from,int *pLeft)
+TryCopyStr(char *to,const char *from,int *pLeft)
 {
 register int len;
     if (*pLeft>0) {
commit cccafabd56d0f8e5784ea0ad9fdc03224f952bfe
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Nov 3 21:10:51 2011 -0700

    Mark arguments to fopen/popen/system wrappers as const char *
    
    Silencing more gcc -Wwrite-strings warnings
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/include/os.h b/include/os.h
index df35805..2298381 100644
--- a/include/os.h
+++ b/include/os.h
@@ -307,10 +307,10 @@ extern _X_EXPORT void OsReleaseSignals (void);
 extern _X_EXPORT void OsAbort (void) _X_NORETURN;
 
 #if !defined(WIN32)
-extern _X_EXPORT int System(char *);
-extern _X_EXPORT pointer Popen(char *, char *);
+extern _X_EXPORT int System(const char *);
+extern _X_EXPORT pointer Popen(const char *, const char *);
 extern _X_EXPORT int Pclose(pointer);
-extern _X_EXPORT pointer Fopen(char *, char *);
+extern _X_EXPORT pointer Fopen(const char *, const char *);
 extern _X_EXPORT int Fclose(pointer);
 #else
 #define System(a) system(a)
diff --git a/os/utils.c b/os/utils.c
index c828f01..b49fd32 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1252,7 +1252,7 @@ OsAbort (void)
  */
 
 int
-System(char *command)
+System(const char *command)
 {
     int pid, p;
     void (*csig)(int);
@@ -1302,7 +1302,7 @@ static struct pid {
 OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */
 
 pointer
-Popen(char *command, char *type)
+Popen(const char *command, const char *type)
 {
     struct pid *cur;
     FILE *iop;
@@ -1388,7 +1388,7 @@ Popen(char *command, char *type)
 
 /* fopen that drops privileges */
 pointer
-Fopen(char *file, char *type)
+Fopen(const char *file, const char *type)
 {
     FILE *iop;
 #ifndef HAS_SAVED_IDS_AND_SETEUID
commit 3d0ece5e8467d823afb227b7a7f8b12b906b6ba9
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Nov 3 20:44:43 2011 -0700

    Reduce unnecessary string copying in xkbtext routines
    
    Instead of using sprintf to copy a static string to a local buffer,
    just to pass it to TryCopyStr, pass the static string to TryCopyStr
    directly, as is already done in other parts of this code.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 80348c7..f31f53a 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -772,15 +772,14 @@ char			tbuf[32];
     if (action->type==XkbSA_LockPtrBtn) {
 	switch (act->flags&(XkbSA_LockNoUnlock|XkbSA_LockNoLock)) {
 	    case XkbSA_LockNoLock:
-		sprintf(tbuf,",affect=unlock"); break;
+		TryCopyStr(buf,",affect=unlock",sz); break;
 	    case XkbSA_LockNoUnlock:
-		sprintf(tbuf,",affect=lock"); break;
+		TryCopyStr(buf,",affect=lock",sz); break;
 	    case XkbSA_LockNoUnlock|XkbSA_LockNoLock:
-		sprintf(tbuf,",affect=neither"); break;
+		TryCopyStr(buf,",affect=neither",sz); break;
 	    default:
-		sprintf(tbuf,",affect=both"); break;
+		TryCopyStr(buf,",affect=both",sz); break;
 	}
-	TryCopyStr(buf,tbuf,sz);
     }
     return TRUE;
 }
@@ -1065,15 +1064,14 @@ char			tbuf[32];
     if (action->type==XkbSA_LockDeviceBtn) {
 	switch (act->flags&(XkbSA_LockNoUnlock|XkbSA_LockNoLock)) {
 	    case XkbSA_LockNoLock:
-		sprintf(tbuf,",affect=unlock"); break;
+		TryCopyStr(buf,",affect=unlock",sz); break;
 	    case XkbSA_LockNoUnlock:
-		sprintf(tbuf,",affect=lock"); break;
+		TryCopyStr(buf,",affect=lock",sz); break;
 	    case XkbSA_LockNoUnlock|XkbSA_LockNoLock:
-		sprintf(tbuf,",affect=neither"); break;
+		TryCopyStr(buf,",affect=neither",sz); break;
 	    default:
-		sprintf(tbuf,",affect=both"); break;
+		TryCopyStr(buf,",affect=both",sz); break;
 	}
-	TryCopyStr(buf,tbuf,sz);
     }
     return TRUE;
 }
commit 05d8a7f7a785eff3292f0f0537bb3902930f1b5c
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Oct 29 11:08:17 2011 -0700

    Convert a bunch of sprintf to snprintf calls
    
    This batch is the straightforward set - others are more complex and
    need more analysis to determine right size to pass.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/exa/exa_render.c b/exa/exa_render.c
index 6f2af8a..3974afe 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -103,13 +103,13 @@ exaPrintCompositeFallback(CARD8 op,
     switch(op)
     {
     case PictOpSrc:
-	sprintf(sop, "Src");
+	snprintf(sop, sizeof(sop), "Src");
 	break;
     case PictOpOver:
-	sprintf(sop, "Over");
+	snprintf(sop, sizeof(sop), "Over");
 	break;
     default:
-	sprintf(sop, "0x%x", (int)op);
+	snprintf(sop, sizeof(sop), "0x%x", (int)op);
 	break;
     }
 
diff --git a/hw/dmx/examples/ev.c b/hw/dmx/examples/ev.c
index ba45c2b..ed23b8a 100644
--- a/hw/dmx/examples/ev.c
+++ b/hw/dmx/examples/ev.c
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
 #define test_bit(bit) (mask[(bit)/8] & (1 << ((bit)%8)))
 
     for (i = 0; i < 32; i++) {
-        sprintf(name, "/dev/input/event%d", i);
+        snprintf(name, sizeof(name), "/dev/input/event%d", i);
         if ((fd = open(name, O_RDONLY, 0)) >= 0) {
             ioctl(fd, EVIOCGVERSION, &version);
             ioctl(fd, EVIOCGNAME(sizeof(buf)), buf);
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
     }
 
     if (argc > 1) {
-        sprintf(name, "/dev/input/event%d", atoi(argv[1]));
+        snprintf(name, sizeof(name), "/dev/input/event%d", atoi(argv[1]));
         if ((fd = open(name, O_RDWR, 0)) >= 0) {
             printf("%s: open, fd = %d\n", name, fd);
             for (i = 0; i < LED_MAX; i++) {
diff --git a/hw/dmx/glxProxy/glxscreens.c b/hw/dmx/glxProxy/glxscreens.c
index 01e041c..baa4a65 100644
--- a/hw/dmx/glxProxy/glxscreens.c
+++ b/hw/dmx/glxProxy/glxscreens.c
@@ -120,8 +120,9 @@ static void CalcServerVersionAndExtensions( void )
       __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
    }
 
-   sprintf(GLXServerVersion, "%d.%d DMX %d back-end server(s)",
-              __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens );	 
+   snprintf(GLXServerVersion, sizeof(GLXServerVersion),
+             "%d.%d DMX %d back-end server(s)",
+              __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens );
    /*
     * set the ExtensionsString to the minimum extensions string
     */
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
index 600b50f..69ad8a5 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -140,7 +140,7 @@ ephyrHostXVLogXErrorEvent (Display *a_display,
             mesg, BUFSIZ);
     (void) fprintf(a_fp, mesg, a_err_event->request_code);
     if (a_err_event->request_code < 128) {
-        sprintf(number, "%d", a_err_event->request_code);
+        snprintf(number, sizeof(number), "%d", a_err_event->request_code);
         XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
     } else {
         for (ext = dpy->ext_procs;
@@ -159,7 +159,8 @@ ephyrHostXVLogXErrorEvent (Display *a_display,
         fputs("  ", a_fp);
         (void) fprintf(a_fp, mesg, a_err_event->minor_code);
         if (ext) {
-            sprintf(mesg, "%s.%d", ext->name, a_err_event->minor_code);
+            snprintf(mesg, sizeof(mesg), "%s.%d",
+                     ext->name, a_err_event->minor_code);
             XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
             (void) fprintf(a_fp, " (%s)", buffer);
         }
@@ -182,8 +183,8 @@ ephyrHostXVLogXErrorEvent (Display *a_display,
                 bext = ext;
         }
         if (bext)
-            sprintf(buffer, "%s.%d", bext->name,
-                    a_err_event->error_code - bext->codes.first_error);
+            snprintf(buffer, sizeof(buffer), "%s.%d", bext->name,
+                     a_err_event->error_code - bext->codes.first_error);
         else
             strcpy(buffer, "Value");
         XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ);
diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c
index a53db49..194e7cd 100644
--- a/hw/kdrive/linux/linux.c
+++ b/hw/kdrive/linux/linux.c
@@ -109,7 +109,7 @@ LinuxInit (void)
 	close(fd);
     }
 
-    sprintf(vtname,"/dev/tty%d",vtno); /* /dev/tty1-64 */
+    snprintf(vtname,sizeof(vtname),"/dev/tty%d",vtno); /* /dev/tty1-64 */
 
     if ((LinuxConsoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0)
     {
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 1218547..3e5d051 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -560,7 +560,8 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
     char dummyBuffer[DUMMY_BUFFER_SIZE];
     int currentFileSize, writeThisTime;
 
-    sprintf(pvfb->mmap_file, "%s/Xvfb_screen%d", pfbdir, (int) (pvfb - vfbScreens));
+    snprintf(pvfb->mmap_file, sizeof(pvfb->mmap_file), "%s/Xvfb_screen%d",
+	     pfbdir, (int) (pvfb - vfbScreens));
     if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT|O_RDWR, 0666)))
     {
 	perror("open");
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 9c52878..d1d74f5 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -306,7 +306,7 @@ XF86OptionPtr
 xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val)
 {
     char tmp[16];
-    sprintf(tmp,"%i",val);
+    snprintf(tmp,sizeof(tmp),"%i",val);
     return xf86AddNewOption(optlist,name,tmp);
 }
 
@@ -314,7 +314,7 @@ XF86OptionPtr
 xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val)
 {
     char tmp[32];
-    snprintf(tmp,32,"%f",val);
+    snprintf(tmp,sizeof(tmp),"%f",val);
     return xf86AddNewOption(optlist,name,tmp);
 }
 
@@ -328,7 +328,7 @@ XF86OptionPtr
 xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val)
 {
     char tmp[16];
-    sprintf(tmp, "%lf%%", val);
+    snprintf(tmp, sizeof(tmp), "%lf%%", val);
     return xf86AddNewOption(optlist,name,tmp);
 }
 
diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
index 181c6ab..b7bb913 100644
--- a/hw/xfree86/common/xf86sbusBus.c
+++ b/hw/xfree86/common/xf86sbusBus.c
@@ -88,7 +88,7 @@ xf86SbusProbe(void)
     xf86SbusInfo = malloc(sizeof(psdp));
     *xf86SbusInfo = NULL;
     for (i = 0; i < 32; i++) {
-	sprintf(fbDevName, "/dev/fb%d", i);
+	snprintf(fbDevName, sizeof(fbDevName), "/dev/fb%d", i);
 	CheckSbusDevice(fbDevName, i);
     }
     if (sparcPromInit() >= 0) {
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 30a2a91..d7b4d3c 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -265,20 +265,20 @@ fbdev_open_pci(struct pci_device * pPci, char **namep)
     int	fd, i;
 
     for (i = 0; i < 8; i++) {
-	sprintf(filename, 
+	snprintf(filename, sizeof(filename),
 		"/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics/fb%d",
 		pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
 
 	fd = open(filename, O_RDONLY, 0);
         if (fd < 0) {
-            sprintf(filename,
+            snprintf(filename, sizeof(filename),
                     "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics:fb%d",
                     pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
             fd = open(filename, O_RDONLY, 0);
         }
 	if (fd >= 0) {
 	    close(fd);
-	    sprintf(filename, "/dev/fb%d", i);
+	    snprintf(filename, sizeof(filename), "/dev/fb%d", i);
 
 	    fd = open(filename, O_RDWR, 0);
 	    if (fd != -1) {
diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c
index b58d6a7..7079d62 100644
--- a/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/hw/xfree86/os-support/bsd/bsd_init.c
@@ -446,7 +446,7 @@ xf86OpenSyscons()
 	    }
 
 	    close(fd);
-	    sprintf(vtname, "/dev/ttyv%01x", xf86Info.vtno - 1);
+	    snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 1);
 	    if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0)
 	    {
 		FatalError("xf86OpenSyscons: Cannot open %s (%s)",
@@ -550,13 +550,13 @@ xf86OpenPcvt()
 	    }
 
 	    close(fd);
-            sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
+            snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1);
 	    if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0)
 	    {
 		ErrorF("xf86OpenPcvt: Cannot open %s (%s)",
 			   vtname, strerror(errno));
 		xf86Info.vtno = initialVT;
-	        sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
+	        snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1);
 		if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
 			FatalError("xf86OpenPcvt: Cannot open %s (%s)",
 			   	vtname, strerror(errno));
@@ -602,9 +602,9 @@ xf86OpenWScons()
     /* XXX Is this ok? */
     for (i = 0; i < 8; i++) {
 #if defined(__NetBSD__)
-	sprintf(ttyname, "/dev/ttyE%d", i);
+	snprintf(ttyname, sizeof(ttyname), "/dev/ttyE%d", i);
 #elif defined(__OpenBSD__)
-	sprintf(ttyname, "/dev/ttyC%x", i);
+	snprintf(ttyname,  sizeof(ttyname), "/dev/ttyC%x", i);
 #endif
 	if ((fd = open(ttyname, 2)) != -1)
 	    break;
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index 7829d80..c02d2cd 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -446,14 +446,14 @@ promGetReg(int type)
     if (prop && len >= 4) {
 	unsigned int *reg = (unsigned int *)prop;
 	if (!promP1275 || (type == PROM_NODE_SBUS) || (type == PROM_NODE_EBUS))
-	    sprintf (regstr, "@%x,%x", reg[0], reg[1]);
+	    snprintf (regstr, sizeof(regstr), "@%x,%x", reg[0], reg[1]);
 	else if (type == PROM_NODE_PCI) {
 	    if ((reg[0] >> 8) & 7)
-		sprintf (regstr, "@%x,%x", (reg[0] >> 11) & 0x1f, (reg[0] >> 8) & 7);
+		snprintf (regstr, sizeof(regstr), "@%x,%x", (reg[0] >> 11) & 0x1f, (reg[0] >> 8) & 7);
 	    else
-		sprintf (regstr, "@%x", (reg[0] >> 11) & 0x1f);
+		snprintf (regstr, sizeof(regstr), "@%x", (reg[0] >> 11) & 0x1f);
 	} else if (len == 4)
-	    sprintf (regstr, "@%x", reg[0]);
+	    snprintf (regstr, sizeof(regstr), "@%x", reg[0]);
 	else {
 	    unsigned int regs[2];
 
@@ -465,9 +465,9 @@ promGetReg(int type)
 	    prop = promGetProperty("upa-portid", &len);
 	    if (prop && len == 4) {
 		reg = (unsigned int *)prop;
-		sprintf (regstr, "@%x,%x", reg[0], regs[1]);
+		snprintf (regstr, sizeof(regstr), "@%x,%x", reg[0], regs[1]);
 	    } else
-		sprintf (regstr, "@%x,%x", regs[0] >> 4, regs[1]);
+		snprintf (regstr, sizeof(regstr), "@%x,%x", regs[0] >> 4, regs[1]);
 	}
     }
     return regstr;
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index f18271f..5f3e3a9 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -146,7 +146,7 @@ xf86OpenConsole(void)
 
         i=0;
         while (vcs[i] != NULL) {
-            sprintf(vtname, vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
+            snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
      	    if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
 		break;
             i++;
diff --git a/hw/xfree86/x86emu/debug.c b/hw/xfree86/x86emu/debug.c
index 5eda908..04d0741 100644
--- a/hw/xfree86/x86emu/debug.c
+++ b/hw/xfree86/x86emu/debug.c
@@ -172,7 +172,7 @@ void x86emu_decode_printf (char *x)
 void x86emu_decode_printf2 (char *x, int y)
 {
 	char temp[100];
-	sprintf(temp,x,y);
+	snprintf(temp,sizeof(temp),x,y);
 	sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",temp);
 	M.x86.enc_str_pos += strlen(temp);
 }
diff --git a/os/connection.c b/os/connection.c
index 957b928..c5fc5a0 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -386,7 +386,7 @@ CreateWellKnownSockets(void)
 
     FD_ZERO (&WellKnownConnections);
 
-    sprintf (port, "%d", atoi (display));
+    snprintf (port, sizeof(port), "%d", atoi (display));
 
     if ((_XSERVTransMakeAllCOTSServerListeners (port, &partial,
 	&ListenTransCount, &ListenTransConns) >= 0) &&
@@ -1266,7 +1266,7 @@ void ListenOnOpenFD(int fd, int noxauth) {
         strcpy(port, display_env);
     } else {
         /* Just some default so things don't break and die. */
-        sprintf(port, ":%d", atoi(display));
+        snprintf(port, sizeof(port), ":%d", atoi(display));
     }
 
     /* Make our XtransConnInfo
diff --git a/os/osinit.c b/os/osinit.c
index 45d202d..acea682 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -213,7 +213,7 @@ OsInit(void)
 	    FILE *err;
 
 	    if (strlen (display) + strlen (ADMPATH) + 1 < sizeof fname)
-		sprintf (fname, ADMPATH, display);
+		snprintf (fname, sizeof(fname), ADMPATH, display);
 	    else
 		strcpy (fname, devnull);
 	    /*
diff --git a/os/rpcauth.c b/os/rpcauth.c
index ad6ebf9..989a49a 100644
--- a/os/rpcauth.c
+++ b/os/rpcauth.c
@@ -137,13 +137,14 @@ SecureRPCCheck (unsigned short data_length, const char *data,
     } else {
 	fullname = authdes_ezdecode(data, data_length);
 	if (fullname == (char *)0) {
-	    sprintf(rpc_error, "Unable to authenticate secure RPC client (why=%d)", why);
+	    snprintf(rpc_error, sizeof(rpc_error),
+		     "Unable to authenticate secure RPC client (why=%d)", why);
 	    *reason = rpc_error;
 	} else {
 	    if (ForEachHostInFamily (FamilyNetname, CheckNetName, fullname))
 		return rpc_id;
-	    sprintf(rpc_error, "Principal \"%s\" is not authorized to connect",
-			fullname);
+	    snprintf(rpc_error, sizeof(rpc_error),
+		     "Principal \"%s\" is not authorized to connect", fullname);
 	    *reason = rpc_error;
 	}
     }
diff --git a/os/utils.c b/os/utils.c
index 1c75dfc..c828f01 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -258,7 +258,7 @@ LockServer(void)
    */
   tmppath = LOCK_DIR;
 
-  sprintf(port, "%d", atoi(display));
+  snprintf(port, sizeof(port), "%d", atoi(display));
   len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
 						strlen(LOCK_TMP_PREFIX);
   len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1;
@@ -295,7 +295,7 @@ LockServer(void)
   }
   if (lfd < 0)
     FatalError("Could not create lock file in %s\n", tmp);
-  (void) sprintf(pid_str, "%10ld\n", (long)getpid());
+  snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long)getpid());
   (void) write(lfd, pid_str, 11);
   (void) fchmod(lfd, 0444);
   (void) close(lfd);
diff --git a/os/xdmcp.c b/os/xdmcp.c
index f5331e1..4644071 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1489,7 +1489,7 @@ get_addr_by_name(
     if (port == 0) {
 	pport = NULL;
     } else if (port > 0 && port < 65535) {
-	sprintf(portstr, "%d", port);
+	snprintf(portstr, sizeof(portstr), "%d", port);
     } else {
 	FatalError("Xserver: port out of range: %d\n", port);
     }
@@ -1612,7 +1612,7 @@ get_mcast_options(int argc, char **argv, int i)
     }
 
     if (xdm_udp_port > 0 && xdm_udp_port < 65535) {
-	sprintf(portstr, "%d", xdm_udp_port);
+	snprintf(portstr, sizeof(portstr), "%d", xdm_udp_port);
     } else {
 	FatalError("Xserver: port out of range: %d\n", xdm_udp_port);
     }
diff --git a/randr/rrinfo.c b/randr/rrinfo.c
index fdf3726..02aea52 100644
--- a/randr/rrinfo.c
+++ b/randr/rrinfo.c
@@ -35,7 +35,7 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
     RRModePtr   *modes;
     
     memset (&modeInfo, '\0', sizeof (modeInfo));
-    sprintf (name, "%dx%d", size->width, size->height);
+    snprintf (name, sizeof(name), "%dx%d", size->width, size->height);
     
     modeInfo.width = size->width;
     modeInfo.height = size->height;
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index b3930f8..80348c7 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -119,7 +119,7 @@ char  numBuf[20];
     else if (vmodNames&&(vmodNames[ndx]!=None))
 	 tmp= NameForAtom(vmodNames[ndx]);
     if (tmp==NULL) {
-	sprintf(numBuf,"%d",ndx);
+	snprintf(numBuf,sizeof(numBuf),"%d",ndx);
 	tmp = numBuf;
     }
 
@@ -227,17 +227,17 @@ char	buf[100];
 
     if (format==XkbCFile) {
 	if (ndx<XkbNumModifiers)
-	     sprintf(buf,"%sMapIndex",modNames[ndx]);
+	    snprintf(buf,sizeof(buf),"%sMapIndex",modNames[ndx]);
 	else if (ndx==XkbNoModifier)
-	     sprintf(buf,"XkbNoModifier");
-	else sprintf(buf,"0x%02x",ndx);
+	     snprintf(buf,sizeof(buf),"XkbNoModifier");
+	else snprintf(buf,sizeof(buf),"0x%02x",ndx);
     }
     else {
 	if (ndx<XkbNumModifiers)
 	     strcpy(buf,modNames[ndx]);
 	else if (ndx==XkbNoModifier)
 	     strcpy(buf,"none");
-	else sprintf(buf,"ILLEGAL_%02x",ndx);
+	else snprintf(buf,sizeof(buf),"ILLEGAL_%02x",ndx);
     }
     rtrn= tbGetBuffer(strlen(buf)+1);
     strcpy(rtrn,buf);
@@ -338,7 +338,7 @@ static char buf[32];
 
     if (sym==NoSymbol)
 	 strcpy(buf,"NoSymbol");
-    else sprintf(buf, "0x%lx", (long)sym);
+    else snprintf(buf, sizeof(buf), "0x%lx", (long)sym);
     return buf;
 }
 
@@ -383,13 +383,13 @@ char *rtrn;
 	case XkbSI_AnyOf:	rtrn= siMatchText[2]; break;
 	case XkbSI_AllOf:	rtrn= siMatchText[3]; break;
 	case XkbSI_Exactly:	rtrn= siMatchText[4]; break;
-	default:		sprintf(buf,"0x%x",type&XkbSI_OpMask);
+	default:		snprintf(buf,sizeof(buf),"0x%x",type&XkbSI_OpMask);
 				return buf;
     }
     if (format==XkbCFile) {
 	if (type&XkbSI_LevelOneOnly)
-	     sprintf(buf,"XkbSI_LevelOneOnly|XkbSI_%s",rtrn);
-	else sprintf(buf,"XkbSI_%s",rtrn);
+	     snprintf(buf,sizeof(buf),"XkbSI_LevelOneOnly|XkbSI_%s",rtrn);
+	else snprintf(buf,sizeof(buf),"XkbSI_%s",rtrn);
 	rtrn= buf;
     }
     return rtrn;
@@ -640,12 +640,12 @@ char *rtrn;
     if (type<=XkbSA_LastAction) {
 	rtrn= actionTypeNames[type];
 	if (format==XkbCFile) {
-	    sprintf(buf,"XkbSA_%s",rtrn);
+	    snprintf(buf,sizeof(buf),"XkbSA_%s",rtrn);
 	    return buf;
 	}
 	return rtrn;
     }
-    sprintf(buf,"Private");
+    snprintf(buf,sizeof(buf),"Private");
     return buf;
 }
 
@@ -712,10 +712,10 @@ char			tbuf[32];
     act= &action->group;
     TryCopyStr(buf,"group=",sz);
     if (act->flags&XkbSA_GroupAbsolute)
-	 sprintf(tbuf,"%d",XkbSAGroup(act)+1);
+	 snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act)+1);
     else if (XkbSAGroup(act)<0)
-	 sprintf(tbuf,"%d",XkbSAGroup(act));
-    else sprintf(tbuf,"+%d",XkbSAGroup(act));
+	 snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act));
+    else snprintf(tbuf,sizeof(tbuf),"+%d",XkbSAGroup(act));
     TryCopyStr(buf,tbuf,sz);
     if (act->type==XkbSA_LockGroup)
 	return TRUE;
@@ -738,13 +738,13 @@ char		tbuf[32];
     x= XkbPtrActionX(act);
     y= XkbPtrActionY(act);
     if ((act->flags&XkbSA_MoveAbsoluteX)||(x<0))
-	 sprintf(tbuf,"x=%d",x);
-    else sprintf(tbuf,"x=+%d",x);
+	 snprintf(tbuf,sizeof(tbuf),"x=%d",x);
+    else snprintf(tbuf,sizeof(tbuf),"x=+%d",x);
     TryCopyStr(buf,tbuf,sz);
 
     if ((act->flags&XkbSA_MoveAbsoluteY)||(y<0))
-	 sprintf(tbuf,",y=%d",y);
-    else sprintf(tbuf,",y=+%d",y);
+	 snprintf(tbuf,sizeof(tbuf),",y=%d",y);
+    else snprintf(tbuf,sizeof(tbuf),",y=+%d",y);
     TryCopyStr(buf,tbuf,sz);
     if (act->flags&XkbSA_NoAcceleration)
 	TryCopyStr(buf,",!accel",sz);
@@ -761,12 +761,12 @@ char			tbuf[32];
     act= &action->btn;
     TryCopyStr(buf,"button=",sz);
     if ((act->button>0)&&(act->button<6)) {
-	 sprintf(tbuf,"%d",act->button);
+	 snprintf(tbuf,sizeof(tbuf),"%d",act->button);
 	 TryCopyStr(buf,tbuf,sz);
     }
     else TryCopyStr(buf,"default",sz);
     if (act->count>0) {
-	sprintf(tbuf,",count=%d",act->count);
+	snprintf(tbuf,sizeof(tbuf),",count=%d",act->count);
 	TryCopyStr(buf,tbuf,sz);
     }
     if (action->type==XkbSA_LockPtrBtn) {
@@ -797,8 +797,8 @@ char			tbuf[32];
     if (act->affect==XkbSA_AffectDfltBtn) {
 	TryCopyStr(buf,"affect=button,button=",sz);
 	if ((act->flags&XkbSA_DfltBtnAbsolute)||(XkbSAPtrDfltValue(act)<0))
-	     sprintf(tbuf,"%d",XkbSAPtrDfltValue(act));
-	else sprintf(tbuf,"+%d",XkbSAPtrDfltValue(act));
+	     snprintf(tbuf,sizeof(tbuf),"%d",XkbSAPtrDfltValue(act));
+	else snprintf(tbuf,sizeof(tbuf),"+%d",XkbSAPtrDfltValue(act));
 	TryCopyStr(buf,tbuf,sz);
     }
     return TRUE;
@@ -814,10 +814,10 @@ char		tbuf[64];
     if (act->flags&XkbSA_ISODfltIsGroup) {
 	TryCopyStr(tbuf,"group=",sz);
 	if (act->flags&XkbSA_GroupAbsolute)
-	     sprintf(tbuf,"%d",XkbSAGroup(act)+1);
+	     snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act)+1);
 	else if (XkbSAGroup(act)<0)
-	     sprintf(tbuf,"%d",XkbSAGroup(act));
-	else sprintf(tbuf,"+%d",XkbSAGroup(act));
+	     snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act));
+	else snprintf(tbuf,sizeof(tbuf),"+%d",XkbSAGroup(act));
 	TryCopyStr(buf,tbuf,sz);
     }
     else {
@@ -847,17 +847,17 @@ char		tbuf[64];
 	    nOut++;
 	}
 	if ((act->affect&XkbSA_ISONoAffectGroup)==0) {
-	    sprintf(tbuf,"%sgroups",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sgroups",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if ((act->affect&XkbSA_ISONoAffectPtr)==0) {
-	    sprintf(tbuf,"%spointer",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%spointer",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if ((act->affect&XkbSA_ISONoAffectCtrls)==0) {
-	    sprintf(tbuf,"%scontrols",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%scontrols",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
@@ -875,8 +875,8 @@ char			tbuf[32];
 
     act= &action->screen;
     if ((act->flags&XkbSA_SwitchAbsolute)||(XkbSAScreen(act)<0))
-	 sprintf(tbuf,"screen=%d",XkbSAScreen(act));
-    else sprintf(tbuf,"screen=+%d",XkbSAScreen(act));
+	 snprintf(tbuf,sizeof(tbuf),"screen=%d",XkbSAScreen(act));
+    else snprintf(tbuf,sizeof(tbuf),"screen=+%d",XkbSAScreen(act));
     TryCopyStr(buf,tbuf,sz);
     if (act->flags&XkbSA_SwitchApplication)
 	 TryCopyStr(buf,",!same",sz);
@@ -903,67 +903,67 @@ char			tbuf[32];
     else {
 	int nOut= 0;
 	if (tmp&XkbRepeatKeysMask) {
-	    sprintf(tbuf,"%sRepeatKeys",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sRepeatKeys",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbSlowKeysMask) {
-	    sprintf(tbuf,"%sSlowKeys",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sSlowKeys",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbBounceKeysMask) {
-	    sprintf(tbuf,"%sBounceKeys",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sBounceKeys",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbStickyKeysMask) {
-	    sprintf(tbuf,"%sStickyKeys",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sStickyKeys",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbMouseKeysMask) {
-	    sprintf(tbuf,"%sMouseKeys",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sMouseKeys",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbMouseKeysAccelMask) {
-	    sprintf(tbuf,"%sMouseKeysAccel",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sMouseKeysAccel",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbAccessXKeysMask) {
-	    sprintf(tbuf,"%sAccessXKeys",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sAccessXKeys",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbAccessXTimeoutMask) {
-	    sprintf(tbuf,"%sAccessXTimeout",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sAccessXTimeout",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbAccessXFeedbackMask) {
-	    sprintf(tbuf,"%sAccessXFeedback",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sAccessXFeedback",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbAudibleBellMask) {
-	    sprintf(tbuf,"%sAudibleBell",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sAudibleBell",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbOverlay1Mask) {
-	    sprintf(tbuf,"%sOverlay1",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sOverlay1",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbOverlay2Mask) {
-	    sprintf(tbuf,"%sOverlay2",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sOverlay2",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
 	if (tmp&XkbIgnoreGroupLockMask) {
-	    sprintf(tbuf,"%sIgnoreGroupLock",(nOut>0?"+":""));
+	    snprintf(tbuf,sizeof(tbuf),"%sIgnoreGroupLock",(nOut>0?"+":""));
 	    TryCopyStr(buf,tbuf,sz);
 	    nOut++;
 	}
@@ -990,12 +990,12 @@ char			tbuf[32];
     else if (act->flags&XkbSA_MessageOnPress)
 	 TryCopyStr(buf,"KeyPress",sz);
     else TryCopyStr(buf,"KeyRelease",sz);
-    sprintf(tbuf,",data[0]=0x%02x",act->message[0]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[1]=0x%02x",act->message[1]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[2]=0x%02x",act->message[2]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[3]=0x%02x",act->message[3]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[4]=0x%02x",act->message[4]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[5]=0x%02x",act->message[5]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[0]=0x%02x",act->message[0]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[1]=0x%02x",act->message[1]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[2]=0x%02x",act->message[2]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[3]=0x%02x",act->message[3]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[4]=0x%02x",act->message[4]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[5]=0x%02x",act->message[5]); TryCopyStr(buf,tbuf,sz);
     return TRUE;
 }
 
@@ -1016,9 +1016,9 @@ unsigned		vmods,vmods_mask;
 				(xkb->names->keys[kc].name[0]!='\0')) {
 	char *kn;
 	kn= XkbKeyNameText(xkb->names->keys[kc].name,XkbXKBFile);
-	sprintf(tbuf,"key=%s",kn);
+	snprintf(tbuf,sizeof(tbuf),"key=%s",kn);
     }
-    else sprintf(tbuf,"key=%d",kc);
+    else snprintf(tbuf,sizeof(tbuf),"key=%d",kc);
     TryCopyStr(buf,tbuf,sz);
     if ((act->mods_mask==0)&&(vmods_mask==0))
 	return TRUE;
@@ -1054,12 +1054,12 @@ XkbDeviceBtnAction *	act;
 char			tbuf[32];
 
     act= &action->devbtn;
-    sprintf(tbuf,"device= %d",act->device); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),"device= %d",act->device); TryCopyStr(buf,tbuf,sz);
     TryCopyStr(buf,",button=",sz);
-    sprintf(tbuf,"%d",act->button);
+    snprintf(tbuf,sizeof(tbuf),"%d",act->button);
     TryCopyStr(buf,tbuf,sz);
     if (act->count>0) {
-	sprintf(tbuf,",count=%d",act->count);
+	snprintf(tbuf,sizeof(tbuf),",count=%d",act->count);
 	TryCopyStr(buf,tbuf,sz);
     }
     if (action->type==XkbSA_LockDeviceBtn) {
@@ -1086,14 +1086,14 @@ XkbAnyAction *	act;
 char		tbuf[32];
 
     act= &action->any;
-    sprintf(tbuf,"type=0x%02x",act->type); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[0]=0x%02x",act->data[0]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[1]=0x%02x",act->data[1]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[2]=0x%02x",act->data[2]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[3]=0x%02x",act->data[3]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[4]=0x%02x",act->data[4]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[5]=0x%02x",act->data[5]); TryCopyStr(buf,tbuf,sz);
-    sprintf(tbuf,",data[6]=0x%02x",act->data[6]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),"type=0x%02x",act->type); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[0]=0x%02x",act->data[0]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[1]=0x%02x",act->data[1]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[2]=0x%02x",act->data[2]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[3]=0x%02x",act->data[3]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[4]=0x%02x",act->data[4]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[5]=0x%02x",act->data[5]); TryCopyStr(buf,tbuf,sz);
+    snprintf(tbuf,sizeof(tbuf),",data[6]=0x%02x",act->data[6]); TryCopyStr(buf,tbuf,sz);
     return TRUE;
 }
 
@@ -1135,7 +1135,7 @@ char	buf[ACTION_SZ],*tmp;
 int	sz;
 
     if (format==XkbCFile) {
-	sprintf(buf,
+	snprintf(buf,sizeof(buf),
 	    "{ %20s, { 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x } }",
 	    XkbActionTypeText(action->type,XkbCFile),
 	    action->any.data[0],action->any.data[1],action->any.data[2],
@@ -1143,7 +1143,7 @@ int	sz;
 	    action->any.data[6]);
     }
     else {
-	sprintf(buf,"%s(",XkbActionTypeText(action->type,XkbXKBFile));
+	snprintf(buf,sizeof(buf),"%s(",XkbActionTypeText(action->type,XkbXKBFile));
 	sz= ACTION_SZ-strlen(buf)+2; /* room for close paren and NULL */
 	if (action->type<(unsigned)XkbSA_NumActions)
 	     (*copyActionArgs[action->type])(xkb,action,buf,&sz);
@@ -1163,8 +1163,8 @@ char	buf[256],*tmp;
 
     if (format==XkbCFile) {
 	if (behavior->type==XkbKB_Default)
-	     sprintf(buf,"{   0,    0 }");
-	else sprintf(buf,"{ %3d, 0x%02x }",behavior->type,behavior->data);
+	     snprintf(buf,sizeof(buf),"{   0,    0 }");
+	else snprintf(buf,sizeof(buf),"{ %3d, 0x%02x }",behavior->type,behavior->data);
     }
     else {
 	unsigned 	type,permanent;
@@ -1172,14 +1172,14 @@ char	buf[256],*tmp;
 	permanent=((behavior->type&XkbKB_Permanent)!=0);
 
 	if (type==XkbKB_Lock) {
-	    sprintf(buf,"lock= %s",(permanent?"Permanent":"TRUE"));
+	    snprintf(buf,sizeof(buf),"lock= %s",(permanent?"Permanent":"TRUE"));
 	}
 	else if (type==XkbKB_RadioGroup) {
 	    int 	g;
 	    char	*tmp;
 	    g= ((behavior->data)&(~XkbKB_RGAllowNone))+1;
 	    if (XkbKB_RGAllowNone&behavior->data) {
-		sprintf(buf,"allowNone,");
+		snprintf(buf,sizeof(buf),"allowNone,");
 		tmp= &buf[strlen(buf)];
 	    }
 	    else tmp= buf;
@@ -1197,12 +1197,12 @@ char	buf[256],*tmp;
 		kn= XkbKeyNameText(xkb->names->keys[kc].name,XkbXKBFile);
 	    else {
 		static char tbuf[8];
-		sprintf(tbuf,"%d",kc);
+		snprintf(tbuf,sizeof(tbuf),"%d",kc);
 		kn= tbuf;
 	    }
 	    if (permanent)
-		 sprintf(buf,"permanentOverlay%d= %s",ndx,kn);
-	    else sprintf(buf,"overlay%d= %s",ndx,kn);
+		 snprintf(buf,sizeof(buf),"permanentOverlay%d= %s",ndx,kn);
+	    else snprintf(buf,sizeof(buf),"overlay%d= %s",ndx,kn);
 	}
     }
     tmp= tbGetBuffer(strlen(buf)+1);
commit b967bf2af264726042e2f6ffb9ca7d234f34b56b
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Oct 31 23:01:35 2011 -0700

    Remove xf86FormatPciBusNumber from API, inline the one place its used
    
    Found no calls from current driver modules
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 3185baf..f216d5e 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -104,7 +104,6 @@ extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus,
                                             int *device, int *func);
 extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus,
                                               int device, int func);
-extern _X_EXPORT void xf86FormatPciBusNumber(int busnum, char *buffer);
 extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device * pPci);
 extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device * pPci,
                                           memType base);
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 7788d3f..b3d3b9e 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -82,16 +82,6 @@ static struct pci_slot_match xf86IsolateDevice = {
     PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0
 };
 
-void
-xf86FormatPciBusNumber(int busnum, char *buffer)
-{
-    /* 'buffer' should be at least 8 characters long */
-    if (busnum < 256)
-	sprintf(buffer, "%d", busnum);
-    else
-	sprintf(buffer, "%d@%d", busnum & 0x00ff, busnum >> 8);
-}
-
 /*
  * xf86Bus.c interface
  */
@@ -1346,7 +1336,12 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
 
     pVideo = (struct pci_device *) busData;
 
-    xf86FormatPciBusNumber(pVideo->bus, busnum);
+    if (pVideo->bus < 256)
+	snprintf(busnum, sizeof(busnum), "%d", pVideo->bus);
+    else
+	snprintf(busnum, sizeof(busnum), "%d@%d",
+		 pVideo->bus & 0x00ff, pVideo->bus >> 8);
+
     XNFasprintf(&GDev->busID, "PCI:%s:%d:%d",
 		busnum, pVideo->dev, pVideo->func);
 
commit 6450f6ca7ee070da3b6d70c2d3a6977f018ac421
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Nov 3 22:13:05 2011 -0700

    Move DoShowOptions to xf86Configure.c, delete xf86ShowOpts.c
    
    Gets rid of duplicate static copy of optionTypeToString by putting
    both callers of that helper function in the same source file.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index a273721..2792177 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -35,7 +35,7 @@ xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
 BUILT_SOURCES = xf86DefModeSet.c
 
 AM_LDFLAGS = -r
-libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
+libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
                       xf86Cursor.c $(DGASOURCES) xf86DPMS.c \
                       xf86Events.c xf86Globals.c xf86AutoConfig.c \
                       xf86Option.c xf86Init.c \
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 99b8b48..61e89ed 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -757,3 +757,54 @@ bail:
     fflush(stderr);
     exit(0);
 }
+
+/* Xorg -showopts:
+ *   For each driver module installed, print out the list
+ *   of options and their argument types, then exit
+ *
+ * Author:  Marcus Schaefer, ms at suse.de
+ */
+
+void DoShowOptions (void) {
+	int  i = 0;
+	char **vlist  = 0;
+	char *pSymbol = 0;
+	XF86ModuleData *initData = 0;
+	if (! (vlist = xf86DriverlistFromCompile())) {
+		ErrorF("Missing output drivers\n");
+		goto bail;
+	}
+	xf86LoadModules (vlist,0);
+	free(vlist);
+	for (i = 0; i < xf86NumDrivers; i++) {
+		if (xf86DriverList[i]->AvailableOptions) {
+			OptionInfoPtr pOption = (OptionInfoPtr)(*xf86DriverList[i]->AvailableOptions)(0,0);
+			if (! pOption) {
+				ErrorF ("(EE) Couldn't read option table for %s driver\n",
+					xf86DriverList[i]->driverName
+				);
+				continue;
+			}
+			XNFasprintf(&pSymbol, "%sModuleData",
+				    xf86DriverList[i]->driverName);
+			initData = LoaderSymbol (pSymbol);
+			if (initData) {
+				XF86ModuleVersionInfo *vers = initData->vers;
+				OptionInfoPtr p;
+				ErrorF ("Driver[%d]:%s[%s] {\n",
+					i,xf86DriverList[i]->driverName,vers->vendor
+				);
+				for (p = pOption; p->name != NULL; p++) {
+					ErrorF ("\t%s:%s\n", p->name,
+						optionTypeToString(p->type));
+				}
+				ErrorF ("}\n");
+			}
+		}
+	}
+	bail:
+	OsCleanup (TRUE);
+	AbortDDX (EXIT_ERR_DRIVERS);
+	fflush (stderr);
+	exit (0);
+}
diff --git a/hw/xfree86/common/xf86ShowOpts.c b/hw/xfree86/common/xf86ShowOpts.c
deleted file mode 100644
index a919013..0000000
--- a/hw/xfree86/common/xf86ShowOpts.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86ShopwOpts.c,v 3.80 2003/10/08 14:58:27 dawes Exp $ */
-/*
- * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Alan Hourihane makes no representations
- * about the suitability of this software for any purpose.  It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Author:  Marcus Schaefer, ms at suse.de
- *
- */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "os.h"
-#ifdef XFree86LOADER
-#include "loaderProcs.h"
-#endif
-#include "xf86.h"
-#include "xf86Config.h"
-#include "xf86_OSlib.h"
-#include "xf86Priv.h"
-/* #include "xf86PciData.h" */
-#define IN_XSERVER
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-#include "xf86DDC.h"
-#if defined(__sparc__) && !defined(__OpenBSD__)
-#include "xf86Bus.h"
-#include "xf86Sbus.h"
-#endif
-#include "globals.h"
-
-static const char* 
-optionTypeToSting(OptionValueType type)
-{
-    switch (type) {
-    case OPTV_NONE:
-        return "";
-    case OPTV_INTEGER:
-        return "<int>";
-    case OPTV_STRING:
-        return "<str>";
-    case OPTV_ANYSTR:
-        return "<str>";
-    case OPTV_REAL:
-        return "<real>";
-    case OPTV_BOOLEAN:
-        return "<bool>";
-    case OPTV_FREQ:
-        return "<freq>";
-    case OPTV_PERCENT:
-        return "<percent>";
-    default:
-        return "<undef>";
-    }
-}
-
-void DoShowOptions (void) {
-	int  i = 0;
-	char **vlist  = 0;
-	char *pSymbol = 0;
-	XF86ModuleData *initData = 0;
-	if (! (vlist = xf86DriverlistFromCompile())) {
-		ErrorF("Missing output drivers\n");
-		goto bail;
-	}
-	xf86LoadModules (vlist,0);
-	free(vlist);
-	for (i = 0; i < xf86NumDrivers; i++) {
-		if (xf86DriverList[i]->AvailableOptions) {
-			OptionInfoPtr pOption = (OptionInfoPtr)(*xf86DriverList[i]->AvailableOptions)(0,0);
-			if (! pOption) {
-				ErrorF ("(EE) Couldn't read option table for %s driver\n",
-					xf86DriverList[i]->driverName
-				);
-				continue;                                                       
-			}
-			XNFasprintf(&pSymbol, "%sModuleData",
-				    xf86DriverList[i]->driverName);
-			initData = LoaderSymbol (pSymbol);
-			if (initData) {
-				XF86ModuleVersionInfo *vers = initData->vers;
-				OptionInfoPtr p;
-				ErrorF ("Driver[%d]:%s[%s] {\n",
-					i,xf86DriverList[i]->driverName,vers->vendor
-				);
-				for (p = pOption; p->name != NULL; p++) {
-					ErrorF ("\t%s:%s\n", p->name,
-						optionTypeToSting(p->type));
-				}
-				ErrorF ("}\n");
-			}
-		}
-	}
-	bail:
-	OsCleanup (TRUE);                             
-	AbortDDX (EXIT_ERR_DRIVERS);
-	fflush (stderr);                        
-	exit (0);
-}
commit 43fa1274263f76faaca995f6e498bc3179a857b8
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Oct 31 22:17:35 2011 -0700

    Remove bad code from DoShowOptions (Xorg -showopts handler)
    
    When we want to print a string, it's okay to just print it.
    We don't need to first allocate a buffer 2 bytes bigger than the
    string, copy the entire string unmodified to the buffer, print the
    buffer, and then leak the buffer (though we AbortDDX 8 lines later,
    and then just in case we survived that, call exit as well, so the
    leak is short lived, just oh so pointless).
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xfree86/common/xf86ShowOpts.c b/hw/xfree86/common/xf86ShowOpts.c
index a805916..a919013 100644
--- a/hw/xfree86/common/xf86ShowOpts.c
+++ b/hw/xfree86/common/xf86ShowOpts.c
@@ -107,16 +107,8 @@ void DoShowOptions (void) {
 					i,xf86DriverList[i]->driverName,vers->vendor
 				);
 				for (p = pOption; p->name != NULL; p++) {
-					const char *opttype = optionTypeToSting(p->type);
-					/* XXX: Why overallocate by 2 bytes?
-					 * Otherwise, this would be strdup()
-					 */
-					char *optname = malloc(strlen(p->name) + 2 + 1);
-					if (!optname) {
-						continue;                      
-					}
-					sprintf(optname, "%s", p->name);
-					ErrorF ("\t%s:%s\n", optname,opttype);
+					ErrorF ("\t%s:%s\n", p->name,
+						optionTypeToSting(p->type));
 				}
 				ErrorF ("}\n");
 			}
commit 71a89d97332cc181becc5a5f73166e642f96c076
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Oct 31 21:36:47 2011 -0700

    Convert glx/single2.c:DoGetString() to use asprintf()
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/glx/single2.c b/glx/single2.c
index 9884f40..9f8254b 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -351,12 +351,10 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
     }
     else if ( name == GL_VERSION ) {
 	if ( atof( string ) > atof( GLServerVersion ) ) {
-	    buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
-	    if ( buf == NULL ) {
+	    if ( asprintf( &buf, "%s (%s)", GLServerVersion, string ) == -1) {
 		string = GLServerVersion;
 	    }
 	    else {
-		sprintf( buf, "%s (%s)", GLServerVersion, string );
 		string = buf;
 	    }
 	}
commit f3cb512dc4daaeed389bb4740e21b6e2330e01e1
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Oct 29 11:19:44 2011 -0700

    LogVMessageVerb: Fix const mismatch warning
    
    "log.c", line 382: warning: assignment type mismatch:
    	pointer to char "=" pointer to const char
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/os/log.c b/os/log.c
index 9ee32c9..671a01b 100644
--- a/os/log.c
+++ b/os/log.c
@@ -371,7 +371,7 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
 {
     const char *type_str;
     char tmpFormat[1024];
-    char *new_format;
+    const char *new_format;
 
     type_str = LogMessageTypeVerbString(type, verb);
     if (!type_str)
commit 3d2d88029b29d6e1c53220ad275ba8ba2dedd89e
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Oct 29 11:13:32 2011 -0700

    AuthAudit: clean up string handling calls
    
    The extra "out" pointer to redirect writes to the array isn't needed since
    the removal of LBX (commit a9ed5a87902a), and eliminating it allows more
    logical use of sizeof(addr) in length-checked strlcpy & snprintf calls to
    write to it.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/os/connection.c b/os/connection.c
index b339f4e..957b928 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -499,7 +499,6 @@ AuthAudit (ClientPtr client, Bool letin,
     unsigned int proto_n, char *auth_proto, int auth_id)
 {
     char addr[128];
-    char *out = addr;
     char client_uid_string[64];
     LocalClientCredRec *lcc;
 #ifdef XSERVER_DTRACE
@@ -508,7 +507,7 @@ AuthAudit (ClientPtr client, Bool letin,
 #endif
 
     if (!len)
-        strcpy(out, "local host");
+        strlcpy(addr, "local host", sizeof(addr));
     else
 	switch (saddr->sa_family)
 	{
@@ -516,11 +515,11 @@ AuthAudit (ClientPtr client, Bool letin,
 #if defined(UNIXCONN) || defined(LOCALCONN)
 	case AF_UNIX:
 #endif
-	    strcpy(out, "local host");
+	    strlcpy(addr, "local host", sizeof(addr));
 	    break;
 #if defined(TCPCONN) || defined(STREAMSCONN)
 	case AF_INET:
-	    sprintf(out, "IP %s",
+	    snprintf(addr, sizeof(addr), "IP %s",
 		inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr));
 	    break;
 #if defined(IPv6) && defined(AF_INET6)
@@ -528,13 +527,13 @@ AuthAudit (ClientPtr client, Bool letin,
 	    char ipaddr[INET6_ADDRSTRLEN];
 	    inet_ntop(AF_INET6, &((struct sockaddr_in6 *) saddr)->sin6_addr,
 	      ipaddr, sizeof(ipaddr));
-	    sprintf(out, "IP %s", ipaddr);
+	    snprintf(addr, sizeof(addr), "IP %s", ipaddr);
 	}
 	    break;
 #endif
 #endif
 	default:
-	    strcpy(out, "unknown address");
+	    strlcpy(addr, "unknown address", sizeof(addr));
 	}
 
     if (GetLocalClientCreds(client, &lcc) != -1) {
commit 615f93a3d03d40924365061c6ae242240dd0ab7e
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Nov 1 14:57:41 2011 -0700

    Remove unnecessary variable rtrn in XkbKeysymText
    
    Also removes even more unnecessary use of variable assignment inside
    function arguments.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 1ba10a1..b3930f8 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -334,12 +334,12 @@ static char *buf;
 char *
 XkbKeysymText(KeySym sym,unsigned format)
 {
-static char buf[32],*rtrn;
+static char buf[32];
 
     if (sym==NoSymbol)
-	 strcpy(rtrn=buf,"NoSymbol");
-    else sprintf(rtrn=buf, "0x%lx", (long)sym);
-    return rtrn;
+	 strcpy(buf,"NoSymbol");
+    else sprintf(buf, "0x%lx", (long)sym);
+    return buf;
 }
 
 char *
commit 5f285a30a1d6ffba82ebe5e08a0b68352bb51556
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Nov 1 16:56:18 2011 -0700

    Make XIGetKnownProperty take a const char * argument
    
    Now that MakeAtom takes const char *, so can XIGetKnownProperty.
    Clears 71 warnings from gcc -Wwrite-strings of the form:
    devices.c:145:5: warning: passing argument 1 of 'XIGetKnownProperty' discards qualifiers from pointer target type
    ../include/exevents.h:128:23: note: expected 'char *' but argument is of type 'const char *'
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 14f1491..f726030 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -386,7 +386,7 @@ change_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
  * If name is NULL, None is returned.
  */
 Atom
-XIGetKnownProperty(char *name)
+XIGetKnownProperty(const char *name)
 {
     int i;
 
diff --git a/include/exevents.h b/include/exevents.h
index 720fb2e..12ea378 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -126,7 +126,7 @@ extern _X_EXPORT void XIUnregisterPropertyHandler(
 );
 
 extern _X_EXPORT Atom XIGetKnownProperty(
-        char*                 name
+        const char*           name
 );
 
 extern _X_EXPORT DeviceIntPtr XIGetDevice(xEvent *ev);
commit e0f3633632de609e60950aef07c82df534db7888
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Oct 28 21:31:46 2011 -0700

    Convert ProcRenderQueryFilters to use memcpy instead of strncpy
    
    We just got the string length with strlen, might as well use it
    to copy the whole string quickly instead of checking each character
    a second time to see if it's 0 or not.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/render/render.c b/render/render.c
index ff75409..d82e099 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1800,7 +1800,7 @@ ProcRenderQueryFilters (ClientPtr client)
 	{
 	    j = strlen (ps->filters[i].name);
 	    *names++ = j;
-	    strncpy (names, ps->filters[i].name, j);
+	    memcpy (names, ps->filters[i].name, j);
 	    names += j;
 	}
 	
@@ -1809,7 +1809,7 @@ ProcRenderQueryFilters (ClientPtr client)
 	{
 	    j = strlen (ps->filterAliases[i].alias);
 	    *names++ = j;
-	    strncpy (names, ps->filterAliases[i].alias, j);
+	    memcpy (names, ps->filterAliases[i].alias, j);
 	    names += j;
 	}
     }
commit 780133f9ae7fada462714b47e79d26075bbd9abe
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Oct 28 21:29:50 2011 -0700

    Convert DetermineClientCmd to use strdup instead of malloc+strncpy
    
    *cmdname is initialized to NULL earlier in the function, so it's
    okay to overwrite it with NULL if strdup fails, don't need that
    extra check.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/os/client.c b/os/client.c
index b534977..4aec097 100644
--- a/os/client.c
+++ b/os/client.c
@@ -149,13 +149,7 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
     cmdsize = strlen(path) + 1;
     if (cmdname)
     {
-        char *name = malloc(cmdsize);
-        if (name)
-        {
-            strncpy(name, path, cmdsize);
-            name[cmdsize - 1] = '\0';
-            *cmdname = name;
-        }
+        *cmdname = strdup(path);
     }
 
     /* Construct the arguments for client process. */
commit 03ddca6f71339fad089c56484bf35c63642ae1be
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Oct 28 21:25:20 2011 -0700

    Convert dmxSetDefaultFontPath to use strdup instead of malloc+strncpy
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index b950c50..57c2425 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -800,20 +800,17 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
 /* RATS: Assuming the fp string (which comes from the command-line argv
          vector) is NULL-terminated, the buffer is large enough for the
          strcpy. */ 
-static void dmxSetDefaultFontPath(char *fp)
+static void dmxSetDefaultFontPath(const char *fp)
 {
-    int fplen = strlen(fp) + 1;
-    
     if (dmxFontPath) {
-	int len;
+	int fplen = strlen(fp) + 1;
+	int len = strlen(dmxFontPath);
 
-	len = strlen(dmxFontPath);
 	dmxFontPath = realloc(dmxFontPath, len+fplen+1);
 	dmxFontPath[len] = ',';
 	strncpy(&dmxFontPath[len+1], fp, fplen);
     } else {
-	dmxFontPath = malloc(fplen);
-	strncpy(dmxFontPath, fp, fplen);
+	dmxFontPath = strdup(fp);
     }
 
     defaultFontPath = dmxFontPath;
commit d9243777c77d9b2992fbaf7f459430283837e323
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Oct 29 10:32:52 2011 -0700

    matchDriverFromFiles: use one snprintf instead of strncpy/cat series
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 1fee937..7788d3f 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1219,9 +1219,8 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
         /* A tiny bit of sanity checking. We should probably do better */
         if (strncmp(&(direntry->d_name[len-4]), ".ids", 4) == 0) {
             /* We need the full path name to open the file */
-            strncpy(path_name, PCI_TXT_IDS_PATH, 256);
-            strncat(path_name, "/", 1);
-            strncat(path_name, direntry->d_name, (256 - strlen(path_name) - 1));
+            snprintf(path_name, sizeof(path_name), "%s/%s",
+                     PCI_TXT_IDS_PATH, direntry->d_name);
             fp = fopen(path_name, "r");
             if (fp == NULL) {
                 xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n", path_name);
commit 6e6d732bac3c21cb85f8e998908f9b393630e5f8
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Oct 28 21:18:46 2011 -0700

    Convert strncpy/strncat to strlcpy/strlcat
    
    As long as we're carrying around a compatibility copy in os/strl*.c,
    might as well use them.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index bc78b55..47b9f47 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -777,14 +777,12 @@ xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
 		       int patchLevel)
 {
     XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
-    strncpy(pScreenPriv->clientDriverName, name,
+    strlcpy(pScreenPriv->clientDriverName, name,
 	    DR_CLIENT_DRIVER_NAME_SIZE);
-    strncpy(pScreenPriv->busID, busID, DR_BUSID_SIZE);
+    strlcpy(pScreenPriv->busID, busID, DR_BUSID_SIZE);
     pScreenPriv->major = major;
     pScreenPriv->minor = minor;
     pScreenPriv->patchLevel = patchLevel;
-    pScreenPriv->clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE-1] = 0;
-    pScreenPriv->busID[DR_BUSID_SIZE-1] = 0;
     return Success;
 }
 
diff --git a/hw/dmx/config/dmxcompat.c b/hw/dmx/config/dmxcompat.c
index b4190ff..98c52eb 100644
--- a/hw/dmx/config/dmxcompat.c
+++ b/hw/dmx/config/dmxcompat.c
@@ -94,8 +94,7 @@ static void dmxVDLDisplayEntry(const char *buf,
     char       *end;
 
     pt   = strchr(buf, ' ');
-    strncpy(name, buf, pt-buf);
-    name[pt-buf] = '\0';
+    strlcpy(name, buf, 1+pt-buf);
     *len  = strlen(name);
     
     *x     = strtol(pt, &end, 10);
diff --git a/hw/dmx/config/scanner.l b/hw/dmx/config/scanner.l
index f5bb73b..e527d6d 100644
--- a/hw/dmx/config/scanner.l
+++ b/hw/dmx/config/scanner.l
@@ -153,7 +153,7 @@ static int getdimension(int token, const char *text, int leng)
     char *tmp = dmxConfigAlloc(leng+1);
     int  x, y;
 
-    strncpy(tmp, text, leng);
+    strlcpy(tmp, text, leng+1);
     x = strtol(tmp, &endptr, 10);
     while (*endptr && !isdigit(*endptr)) ++endptr;
     y = strtol(endptr, NULL, 10);
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 165476c..b950c50 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -138,7 +138,7 @@ static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
         for (ext = dpy->ext_procs;
              ext && ext->codes.major_opcode != ev->request_code;
              ext = ext->next);
-        if (ext) strncpy(buf, ext->name, sizeof(buf));
+        if (ext) strlcpy(buf, ext->name, sizeof(buf));
         else     buf[0] = '\0';
     }
     dmxLog(dmxWarning, "                 Major opcode: %d (%s)\n",
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index cb4be42..cc79973 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -195,8 +195,7 @@ xf86ValidateFontPath(char *path)
 	dirlen = p1 - path_elem;
       else
 	dirlen = strlen(path_elem);
-      strncpy(dir_elem, path_elem, dirlen);
-      dir_elem[dirlen] = '\0';
+      strlcpy(dir_elem, path_elem, dirlen + 1);
       flag = stat(dir_elem, &stat_buf);
       if (flag == 0)
 	if (!S_ISDIR(stat_buf.st_mode))
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 7feb48c..b9753f0 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -460,10 +460,9 @@ HostOS(void)
 
     if (*host_os == '\0') {
         if (uname(&name) >= 0)
-            strcpy(host_os, name.sysname);
+            strlcpy(host_os, name.sysname, sizeof(host_os));
         else {
-            strncpy(host_os, "unknown", sizeof(host_os));
-            host_os[sizeof(host_os)-1] = '\0';
+            strlcpy(host_os, "unknown", sizeof(host_os));
         }
     }
     return host_os;
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 87dc025..1fee937 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1235,8 +1235,7 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
 #endif /* __GLIBC __ */
                 xchomp(line);
                 if (isdigit(line[0])) {
-                    strncpy(vendor_str, line, 4);
-                    vendor_str[4] = '\0';
+                    strlcpy(vendor_str, line, sizeof(vendor_str));
                     vendor = (int)strtol(vendor_str, NULL, 16);
                     if ((strlen(&line[4])) == 0) {
                         chip_str[0] = '\0';
@@ -1248,8 +1247,7 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
                             chip = -1;
                         } else {
                             /* Ok, it's a real ID */
-                            strncpy(chip_str, &line[4], 4);
-                            chip_str[4] = '\0';
+                            strlcpy(chip_str, &line[4], sizeof(chip_str));
                             chip = (int)strtol(chip_str, NULL, 16);
                         }
                     }
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 99b3257..8470789 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -281,8 +281,10 @@ again:
 				if (builtinConfig[builtinIndex] == NULL)
 					ret = NULL;
 				else {
-					ret = strncpy(configBuf, builtinConfig[builtinIndex],
-							CONFIG_BUF_LEN);
+					strlcpy(configBuf,
+						builtinConfig[builtinIndex],
+						CONFIG_BUF_LEN);
+					ret = configBuf;
 					builtinIndex++;
 				}
 			}
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 8bae6b0..a58f2c7 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -813,8 +813,7 @@ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
 	return FALSE;
     }
     
-    strncpy(path, shared->shmPath, pathmax);
-    path[pathmax - 1] = '\0';
+    strlcpy(path, shared->shmPath, pathmax);
     
     dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared);
 
diff --git a/os/access.c b/os/access.c
index f31626d..1598940 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1756,8 +1756,7 @@ siHostnameAddrMatch(int family, pointer addr, int len,
 	if (siAddrLen >= sizeof(hostname)) 
 	    return FALSE;
 
-	strncpy(hostname, siAddr, siAddrLen);
-	hostname[siAddrLen] = '\0';
+	strlcpy(hostname, siAddr, siAddrLen + 1);
 
 	if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) {
 	    for (a = addresses ; a != NULL ; a = a->ai_next) {
@@ -1786,8 +1785,7 @@ siHostnameAddrMatch(int family, pointer addr, int len,
 	if (siAddrLen >= sizeof(hostname)) 
 	    return FALSE;
 
-	strncpy(hostname, siAddr, siAddrLen);
-	hostname[siAddrLen] = '\0';
+	strlcpy(hostname, siAddr, siAddrLen + 1);
 
 	if ((hp = _XGethostbyname(hostname, hparams)) != NULL) {
 #ifdef h_addr				/* new 4.3bsd version of gethostent */
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 219d39c..1961423 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -263,8 +263,7 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		xkb,
             if (xkbDebugFlags)
                 DebugF("[xkb] xkb executes: %s\n",buf);
 	    if (nameRtrn) {
-		strncpy(nameRtrn,keymap,nameRtrnLen);
-		nameRtrn[nameRtrnLen-1]= '\0';
+		strlcpy(nameRtrn,keymap,nameRtrnLen);
 	    }
             free(buf);
 #ifdef WIN32
@@ -322,8 +321,7 @@ FILE *	file;
     }
     else file= NULL;
     if ((fileNameRtrn!=NULL)&&(fileNameRtrnLen>0)) {
-	strncpy(fileNameRtrn,buf,fileNameRtrnLen);
-	buf[fileNameRtrnLen-1]= '\0';
+	strlcpy(fileNameRtrn,buf,fileNameRtrnLen);
     }
     return file;
 }
diff --git a/xkb/maprules.c b/xkb/maprules.c
index f940899..a14fbbb 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -250,8 +250,7 @@ get_index(char *str, int *ndx)
        *ndx = -1;
        return end + 1;
    }
-   strncpy(ndx_buf, str, end - str);
-   ndx_buf[end - str] = '\0';
+   strlcpy(ndx_buf, str, 1 + end - str);
    *ndx = atoi(ndx_buf);
    return end + 1;
 }
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 9f49d59..1ba10a1 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -81,8 +81,7 @@ char	*rtrn,*tmp;
 	if (len>BUFFER_SIZE)
 	    len= BUFFER_SIZE-2;
 	rtrn= tbGetBuffer(len);
-	strncpy(rtrn,atmstr,len);
-	rtrn[len]= '\0';
+	strlcpy(rtrn,atmstr,len);
     }
     else {
 	rtrn= tbGetBuffer(1);
commit e189dbb3e57d30eb96034d4ce9544ce7a93a371e
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Oct 28 20:19:44 2011 -0700

    Convert AllocXTestDevice to use asprintf
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 945e202..b69de35 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -608,12 +608,11 @@ int AllocXTestDevice (ClientPtr client, char* name,
                      DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
 {
     int retval;
-    int len = strlen(name);
-    char *xtestname = calloc(len + 7, 1 );
+    char *xtestname;
     char dummy = 1;
 
-    strncpy( xtestname, name, len);
-    strncat( xtestname, " XTEST", 6 );
+    if (asprintf(&xtestname, "%s XTEST", name) == -1)
+	return BadAlloc;
 
     retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
     if ( retval == Success ){
commit 08093c25a91c07ab8af7cece9bba738b827cfd1b
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Oct 24 23:16:30 2011 -0700

    Convert some malloc + strncpy pairs into strndup calls
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/dix/atom.c b/dix/atom.c
index 88b40db..83ff71a 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -118,14 +118,11 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
 	}
 	else
 	{
-	    char *newstring = malloc(len + 1);
-	    if (!newstring) {
+	    nd->string = strndup(string, len);
+	    if (!nd->string) {
 		free(nd);
 		return BAD_RESOURCE;
 	    }
-	    strncpy(newstring, string, (int)len);
-	    newstring[len] = 0;
-	    nd->string = newstring;
 	}
 	if ((lastAtom + 1) >= tableLength) {
 	    NodePtr *table;
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 6a1ce49..9c0b34f 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1049,12 +1049,10 @@ KdGetOptions (InputOption **options, char *string)
     if (strchr(string, '='))
     {
         tam_key = (strchr(string, '=') - string);
-        key = malloc(tam_key + 1);
+        key = strndup(string, tam_key);
         if (!key)
             goto out;
 
-        strncpy(key, string, tam_key);
-        key[tam_key] = '\0';
         value = strdup(strchr(string, '=') + 1);
         if (!value)
             goto out;
diff --git a/os/utils.c b/os/utils.c
index 07cf4c2..1c75dfc 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1664,13 +1664,11 @@ CheckUserParameters(int argc, char **argv, char **envp)
 		    if (!eq)
 			continue;
 		    len = eq - envp[i];
-		    e = malloc(len + 1);
+		    e = strndup(envp[i], len);
 		    if (!e) {
 			bad = InternalError;
 			break;
 		    }
-		    strncpy(e, envp[i], len);
-		    e[len] = 0;
 		    if (len >= 4 &&
 			(strcmp(e + len - 4, "PATH") == 0 ||
 			 strcmp(e, "TERMCAP") == 0)) {
commit acde97a39d35bfb03af2614c68176ad9afb71f53
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Oct 24 20:28:32 2011 -0700

    Add fallback implementation of strndup()
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Linux test code fixed by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 1d40029..e4fcba4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -218,6 +218,8 @@ AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
 		strtol getopt getopt_long vsnprintf walkcontext backtrace \
 		getisax getzoneid shmctl64 strcasestr ffs vasprintf])
 AC_FUNC_ALLOCA
+AC_CHECK_FUNCS([strndup], [HAVE_STRNDUP=yes], [HAVE_STRNDUP=no])
+AM_CONDITIONAL(NEED_STRNDUP, [test x$HAVE_STRNDUP = xno])
 dnl Old HAS_* names used in os/*.c.
 AC_CHECK_FUNC([getdtablesize],
 	AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.]))
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 7d6cb96..e1d3a9e 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -190,6 +190,9 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the `strndup' function. */
+#undef HAVE_STRNDUP
+
 /* Define to 1 if you have the `strrchr' function. */
 #undef HAVE_STRRCHR
 
diff --git a/include/os.h b/include/os.h
index 823fe5d..df35805 100644
--- a/include/os.h
+++ b/include/os.h
@@ -492,6 +492,10 @@ extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz);
 extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz);
 #endif
 
+#ifndef HAVE_STRNDUP
+extern _X_EXPORT char * strndup(const char *str, size_t n);
+#endif
+
 /* Logging. */
 typedef enum _LogParameter {
     XLOG_FLUSH,
diff --git a/os/Makefile.am b/os/Makefile.am
index ef9ecdd..8dd8095 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -41,6 +41,10 @@ if NEED_STRLCAT
 libos_la_SOURCES += $(STRLCAT_SRCS)
 endif
 
+if NEED_STRNDUP
+libos_la_SOURCES += $(STRNDUP_SRCS)
+endif
+
 EXTRA_DIST = $(SECURERPC_SRCS) $(INTERNALMALLOC_SRCS) \
      $(XDMCP_SRCS) $(STRLCAT_SRCS)
 
diff --git a/os/strndup.c b/os/strndup.c
new file mode 100644
index 0000000..bf8e982
--- /dev/null
+++ b/os/strndup.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include "os.h"
+
+char *
+strndup(const char *str, size_t n)
+{
+	size_t len;
+	char *copy;
+
+	for (len = 0; len < n && str[len]; len++)
+		continue;
+
+	if ((copy = malloc(len + 1)) == NULL)
+		return (NULL);
+	memcpy(copy, str, len);
+	copy[len] = '\0';
+	return (copy);
+}
diff --git a/test/.gitignore b/test/.gitignore
index 0e1ed42..7dcad36 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -4,3 +4,4 @@ xtest
 list
 misc
 fixes
+string
diff --git a/test/Makefile.am b/test/Makefile.am
index 06ea653..62c398c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,6 +1,6 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= . xi2
-noinst_PROGRAMS = xkb input xtest list misc fixes xfree86
+noinst_PROGRAMS = xkb input xtest list misc fixes xfree86 string
 check_LTLIBRARIES = libxservertest.la
 
 TESTS=$(noinst_PROGRAMS)
diff --git a/test/string.c b/test/string.c
new file mode 100644
index 0000000..e3a5adb
--- /dev/null
+++ b/test/string.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Tests for fallback implementations of string handling routines
+ * provided in os/ subdirectory for some platforms.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <assert.h>
+#include "os.h"
+
+/* Ensure we're testing our functions, even on platforms with libc versions */
+#include <string.h>
+#undef strndup
+#define strndup my_strndup
+char *
+strndup(const char *str, size_t n);
+
+#include "../os/strndup.c"
+
+static void strndup_checks(void)
+{
+    const char *sample="0123456789abcdef";
+    char *allofit;
+
+    char *firsthalf = strndup(sample, 8);
+    char *secondhalf = strndup(sample + 8, 8);
+
+    assert(strcmp(firsthalf,  "01234567") == 0);
+    assert(strcmp(secondhalf, "89abcdef") == 0);
+
+    free(firsthalf);
+    free(secondhalf);
+
+    allofit = strndup(sample, 20);
+    assert(strcmp(allofit, sample) == 0);
+    free(allofit);
+}
+
+int main(int argc, char** argv)
+{
+    strndup_checks();
+
+    return 0;
+}
commit ed38c2648cf7cc04c1d03f8d14375815f6cf536e
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Oct 28 14:32:56 2011 -0700

    Fix Sun compiler check that got turned around
    
    Since the check is for !(compilers that support __builtin_constant_p)
    it needs to be !(gcc or new enough Sun cc), but was written as
    !(gcc or too old Sun cc).
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/include/misc.h b/include/misc.h
index dc03911..2e8dd1b 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -269,7 +269,7 @@ static inline void wrong_size(void)
 }
 #endif
 
-#if !(defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C < 0x590)))
+#if !(defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)))
 static inline int __builtin_constant_p(int x)
 {
 	return 0;
commit 7ee7fd1f4c72b2ab6dba0413e63dd2e8b95b2112
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Oct 24 20:39:24 2011 -0700

    Remove a couple Error() instances left behind by 09dbfcb0ad7b6c8
    
    Two instances found in the SIOCGIFCONF code for listing network interfaces.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/access.c b/os/access.c
index b7b1927..f31626d 100644
--- a/os/access.c
+++ b/os/access.c
@@ -528,7 +528,7 @@ DefineSelf (int fd)
     ifn.lifn_family = AF_UNSPEC;
     ifn.lifn_flags = 0;
     if (ioctl (fd, SIOCGLIFNUM, (char *) &ifn) < 0)
-        Error ("Getting interface count");    
+        ErrorF ("Getting interface count: %s\n", strerror(errno));
     if (len < (ifn.lifn_count * sizeof(struct lifreq))) {
 	len = ifn.lifn_count * sizeof(struct lifreq);
 	bufptr = malloc(len);
@@ -558,7 +558,7 @@ DefineSelf (int fd)
 #endif
 
     if (ifioctl (fd, IFC_IOCTL_REQ, (pointer) &ifc) < 0)
-        Error ("Getting interface configuration (4)");
+        ErrorF ("Getting interface configuration (4): %s\n", strerror(errno));
 
     cplim = (char *) IFC_IFC_REQ + IFC_IFC_LEN;
     
commit e47aa9475027ed6a255daefec85561c6b15789bd
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Oct 24 23:40:45 2011 -0700

    Enable memory checking during unit testing
    
    If configure is generated with xorg-macros 1.16.0 or newer, and
    an appropriate memory checking library is found for the platform,
    use it when running unit tests.   If not, then no harm is done.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/test/Makefile.am b/test/Makefile.am
index 1804378..06ea653 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -4,6 +4,7 @@ noinst_PROGRAMS = xkb input xtest list misc fixes xfree86
 check_LTLIBRARIES = libxservertest.la
 
 TESTS=$(noinst_PROGRAMS)
+TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 INCLUDES = $(XORG_INCS) -I$(top_srcdir)/hw/xfree86/parser \
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index d72bcda..c6e93e7 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -13,6 +13,7 @@ noinst_PROGRAMS =  \
         protocol-eventconvert
 
 TESTS=$(noinst_PROGRAMS)
+TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 INCLUDES = @XORG_INCS@
commit 36670065bd74b870d0da7c6a69a9c0d222b21706
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Oct 25 00:12:48 2011 -0700

    Don't require ld -wrap for tests that don't need it
    
    If configure is generated with xorg-macros 1.16 or later, this allows
    builders to --enable-unit-test and run the tests other than the xi2
    tests which require ld -wrap (and are still wrapped in if HAVE_LD_WRAP
    in tests/xi2/Makefile).  If an older xorg-macros is used, the existing
    behaviour is preserved of requiring ld -wrap for all unit tests, but
    no side effects occur, so the minimum xorg-macros version is not raised.
    
    If unit testing is enabled without ld -wrap, then we create a bogus
    "xi2-tests" script just to report that we're skipping them.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index e804030..1d40029 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ XORG_WITH_XMLTO(0.0.20)
 XORG_WITH_FOP
 XORG_WITH_XSLTPROC
 XORG_ENABLE_UNIT_TESTS
-XORG_LD_WRAP
+XORG_LD_WRAP([optional])
 
 m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
 XORG_FONT_MACROS_VERSION(1.1)
diff --git a/test/Makefile.am b/test/Makefile.am
index 689dd7f..1804378 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,5 +1,4 @@
 if ENABLE_UNIT_TESTS
-if HAVE_LD_WRAP
 SUBDIRS= . xi2
 noinst_PROGRAMS = xkb input xtest list misc fixes xfree86
 check_LTLIBRARIES = libxservertest.la
@@ -43,4 +42,3 @@ libxservertest_la_LIBADD = \
             @XORG_LIBS@
 libxservertest_la_DEPENDENCIES = $(libxservertest_la_LIBADD)
 endif
-endif
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index b15d8ba..d72bcda 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -53,5 +53,14 @@ protocol_xigetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xigetclientpointe
 protocol_xiquerypointer_SOURCES=$(COMMON_SOURCES) protocol-xiquerypointer.c
 protocol_xipassivegrabdevice_SOURCES=$(COMMON_SOURCES) protocol-xipassivegrabdevice.c
 protocol_xiwarppointer_SOURCES=$(COMMON_SOURCES) protocol-xiwarppointer.c
+else
+# Print that xi2-tests were skipped (exit code 77 for automake test harness)
+TESTS = xi2-tests
+CLEANFILES = $(TESTS)
+
+xi2-tests:
+	@echo 'echo "ld -wrap support required for xi2 unit tests, skipping"' > $@
+	@echo 'exit 77' >> $@
+	$(AM_V_GEN)chmod +x $@
 endif
 endif
commit 0e6b88db7f2e94ccc8153a0e002d176440914e01
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Aug 1 14:09:33 2011 -0700

    Don't fallback to wsfb or fbdev on Solaris
    
    We don't ship either one, so don't waste time and make confusing log
    entries trying to load them.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 7fc6518..0c46568 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -267,6 +267,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
 #endif
     }
 
+#if !defined(sun)
     /* Fallback to platform default frame buffer driver */
     if (i < (nmatches - 1)) {
 #if !defined(__linux__) && defined(__sparc__)
@@ -275,6 +276,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
 	matches[i++] = xnfstrdup("fbdev");
 #endif
     }
+#endif /* !sun */
 }
 
 /* copy a screen section and enter the desired driver
commit 7b0f53f0a5824fcd81ef505beb3e19ac7c77961f
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Wed Nov 23 10:50:13 2011 -0800

    Fix Xdmx build on Linux to work with strlcpy changes
    
    Include strlcpy.c in the  libdmxconfig.a library with the other functions
    shared among the xdmx configuration programs.
    
    Also add a #include "os.h" to the scanner.l file that now calls strlcpy
    to include the prototype from $(top_srcdir)/include/os.h.
    
    (To be squashed into
    http://cgit.freedesktop.org/~alanc/xserver/commit/?id=c19f0ff5223d428f8ad2ab3c563c974c96a521ba
    before next PULL request to avoid breaking bisection.)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/dmx/config/Makefile.am b/hw/dmx/config/Makefile.am
index de4ce31..7518143 100644
--- a/hw/dmx/config/Makefile.am
+++ b/hw/dmx/config/Makefile.am
@@ -22,6 +22,10 @@ MAINTAINERCLEANFILES = $(BUILT_SOURCES)
 
 libdmxconfig_a_SOURCES = $(LIBSRCS)
 
+if NEED_STRLCAT
+libdmxconfig_a_SOURCES += $(top_srcdir)/os/strlcpy.c
+endif
+
 if GLX
 GLX_DEFS = @GL_CFLAGS@
 endif	    
diff --git a/hw/dmx/config/scanner.l b/hw/dmx/config/scanner.l
index cef99d0..f5bb73b 100644
--- a/hw/dmx/config/scanner.l
+++ b/hw/dmx/config/scanner.l
@@ -39,6 +39,7 @@
 
 #include "dmxparse.h"
 #include "parser.h"
+#include "os.h"
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
commit 922c1d817091c7eedfb701f4d9eb4324e22ccca4
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Fri Nov 11 20:44:19 2011 -0500

    docs: spell "X Server Version" consistently in titles. Add where missing.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/Xinput.xml b/doc/Xinput.xml
index 0a7ec8d..7f576a1 100644
--- a/doc/Xinput.xml
+++ b/doc/Xinput.xml
@@ -15,7 +15,7 @@
          <affiliation><orgname>Hewlett-Packard</orgname></affiliation>
       </author>
    </authorgroup>
-   <releaseinfo>X server version &xserver.version;</releaseinfo>
+   <releaseinfo>X Server Version &xserver.version;</releaseinfo>
    <copyright><year>1989</year><year>1990</year><year>1991</year>
      <holder>Hewlett-Packard Company</holder>
    </copyright>
diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index 2bf4fb3..5c481c9 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -43,7 +43,7 @@
     </author>
     <publisher><publishername>The X.Org Foundation</publishername></publisher>
     <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
-    <releaseinfo>X server version &xserver.version;</releaseinfo>
+    <releaseinfo>X Server Version &xserver.version;</releaseinfo>
     <copyright><year>1994</year><holder>X Consortium, Inc.</holder></copyright>
     <copyright><year>2004</year><holder>X.org Foundation, Inc.</holder></copyright>
     <legalnotice>
diff --git a/doc/dtrace/Xserver-DTrace.xml b/doc/dtrace/Xserver-DTrace.xml
index fa8bc80..5ef0629 100644
--- a/doc/dtrace/Xserver-DTrace.xml
+++ b/doc/dtrace/Xserver-DTrace.xml
@@ -14,7 +14,7 @@
 	<orgdiv>Solaris Engineering</orgdiv>
       </affiliation>
     </author>
-    <releaseinfo>X.Org Xserver version &xserver.version;</releaseinfo>
+    <releaseinfo>X Server Version &xserver.version;</releaseinfo>
     <copyright><year>2005</year><year>2006</year><year>2007</year><year>2010</year>
       <holder>Oracle and/or its affiliates. All rights reserved.</holder>
     </copyright>
diff --git a/hw/dmx/doc/dmx.xml b/hw/dmx/doc/dmx.xml
index 845eec9..793aace 100644
--- a/hw/dmx/doc/dmx.xml
+++ b/hw/dmx/doc/dmx.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
+ <!ENTITY % defs SYSTEM "/xserver/doc/xml/xserver.ent"> %defs;
 ]>
 
 <article>
@@ -14,6 +15,7 @@
       <author><firstname>Rickard E.</firstname><surname>Faith</surname></author>
     </authorgroup>
     <pubdate>29 June 2004 (created 25 July 2001)</pubdate>
+    <releaseinfo>X Server Version &xserver.version;</releaseinfo>
     <abstract><para>
         This document covers the motivation, background, design, and
         implementation of the distributed multihead X (DMX) system.  It
diff --git a/hw/dmx/doc/scaled.xml b/hw/dmx/doc/scaled.xml
index 48c83e0..30c9b9f 100644
--- a/hw/dmx/doc/scaled.xml
+++ b/hw/dmx/doc/scaled.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
+ <!ENTITY % defs SYSTEM "/xserver/doc/xml/xserver.ent"> %defs;
 ]>
   <article>
 
@@ -12,6 +13,7 @@
       <author><firstname>Rickard E.</firstname><surname>Faith</surname></author>
     </authorgroup>
     <pubdate>15 October 2003 (created 19 September 2003)</pubdate>
+    <releaseinfo>X Server Version &xserver.version;</releaseinfo>
     <abstract>
       <para>
       This document investigates the possibility of adding scaled window
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index c406cd7..a1212a6 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -34,7 +34,7 @@
 
     <pubdate>&xserver.reldate;</pubdate>
     <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
-    <releaseinfo>Xorg server version &xserver.version;</releaseinfo>
+    <releaseinfo>X Server Version &xserver.version;</releaseinfo>
 
   </articleinfo>
 
commit 5952efa903d57ac69070f1477ce46223a2a7893c
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Nov 20 13:07:33 2011 -0800

    Bump version to 1.11.99.1 (1.12 development release 1)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 63d59f9..e804030 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.11.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2011-08-26"
+AC_INIT([xorg-server], 1.11.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2011-11-20"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 795fbe3e6e440f023e52c452106f4c266c13d36c
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Nov 20 13:33:12 2011 -0800

    Add 'optionstr.h' to include/Makefile.am
    
    This makes sure it gets distributed
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/Makefile.am b/include/Makefile.am
index 6f63c76..972f403 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -32,6 +32,7 @@ sdk_HEADERS =		\
 	misc.h		\
 	miscstruct.h	\
 	opaque.h	\
+	optionstr.h	\
 	os.h		\
 	pixmap.h	\
 	pixmapstr.h	\


More information about the Xquartz-changes mailing list