xserver: Branch 'master' - 11 commits
Keith Packard
keithp at kemper.freedesktop.org
Wed May 12 16:52:05 PDT 2010
dix/atom.c | 42 ++++++++++++++++++++++++------------------
dix/dispatch.c | 7 +------
dix/dixfonts.c | 7 ++++---
hw/dmx/dmxfont.c | 16 +++++-----------
include/dixfont.h | 3 +--
include/misc.h | 6 ++++++
include/os.h | 7 ++-----
mi/mipolypnt.c | 2 +-
os/log.c | 5 ++---
os/osinit.c | 5 ++---
xkb/ddxLoad.c | 8 +++-----
11 files changed, 51 insertions(+), 57 deletions(-)
New commits:
commit 59857ee5da5f1f3f4900292581b9586477513211
Merge: 21ceae9... 432cbbe...
Author: Keith Packard <keithp at keithp.com>
Date: Wed May 12 16:48:08 2010 -0700
Merge remote branch 'dottedmag/for-keithp'
commit 432cbbec194e47bf2a117c9302146e786c8a4ee1
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Thu May 13 03:51:00 2010 +0700
Misc coding style cleanup
Use a[b] instead of *(a+b), fix whitespace.
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/dix/atom.c b/dix/atom.c
index 7d04c68..88b40db 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -145,8 +145,8 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
*np = nd;
nd->left = nd->right = NULL;
nd->fingerPrint = fp;
- nd->a = (++lastAtom);
- *(nodeTable+lastAtom) = nd;
+ nd->a = ++lastAtom;
+ nodeTable[lastAtom] = nd;
return nd->a;
}
else
@@ -194,7 +194,7 @@ FreeAtom(NodePtr patom)
void
FreeAllAtoms(void)
{
- if(atomRoot == NULL)
+ if (atomRoot == NULL)
return;
FreeAtom(atomRoot);
atomRoot = NULL;
@@ -208,7 +208,7 @@ InitAtoms(void)
{
FreeAllAtoms();
tableLength = InitialTableSize;
- nodeTable = malloc(InitialTableSize*sizeof(NodePtr));
+ nodeTable = malloc(InitialTableSize * sizeof(NodePtr));
if (!nodeTable)
AtomError();
nodeTable[None] = NULL;
commit 816b79dd061e9839cec94a4986a7820b70ca8a7f
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Thu May 13 03:45:21 2010 +0700
Remove useless casts
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/dix/atom.c b/dix/atom.c
index 02843d2..7d04c68 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -68,7 +68,7 @@ typedef struct _Node {
} NodeRec, *NodePtr;
static Atom lastAtom = None;
-static NodePtr atomRoot = (NodePtr)NULL;
+static NodePtr atomRoot = NULL;
static unsigned long tableLength;
static NodePtr *nodeTable;
@@ -88,7 +88,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
fp = fp * 27 + string[i];
fp = fp * 27 + string[len - 1 - i];
}
- while (*np != (NodePtr) NULL)
+ while (*np != NULL)
{
if (fp < (*np)->fingerPrint)
np = &((*np)->left);
@@ -130,11 +130,12 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
if ((lastAtom + 1) >= tableLength) {
NodePtr *table;
- table = (NodePtr *) realloc(nodeTable,
- tableLength * (2 * sizeof(NodePtr)));
+ table = realloc(nodeTable, tableLength * (2 * sizeof(NodePtr)));
if (!table) {
- if (nd->string != string)
- free(nd->string);
+ if (nd->string != string) {
+ /* nd->string has been strdup'ed */
+ free((char *)nd->string);
+ }
free(nd);
return BAD_RESOURCE;
}
@@ -142,7 +143,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
nodeTable = table;
}
*np = nd;
- nd->left = nd->right = (NodePtr) NULL;
+ nd->left = nd->right = NULL;
nd->fingerPrint = fp;
nd->a = (++lastAtom);
*(nodeTable+lastAtom) = nd;
@@ -163,7 +164,7 @@ NameForAtom(Atom atom)
{
NodePtr node;
if (atom > lastAtom) return 0;
- if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0;
+ if ((node = nodeTable[atom]) == NULL) return 0;
return node->string;
}
@@ -193,12 +194,12 @@ FreeAtom(NodePtr patom)
void
FreeAllAtoms(void)
{
- if(atomRoot == (NodePtr)NULL)
+ if(atomRoot == NULL)
return;
FreeAtom(atomRoot);
- atomRoot = (NodePtr)NULL;
+ atomRoot = NULL;
free(nodeTable);
- nodeTable = (NodePtr *)NULL;
+ nodeTable = NULL;
lastAtom = None;
}
@@ -210,7 +211,7 @@ InitAtoms(void)
nodeTable = malloc(InitialTableSize*sizeof(NodePtr));
if (!nodeTable)
AtomError();
- nodeTable[None] = (NodePtr)NULL;
+ nodeTable[None] = NULL;
MakePredeclaredAtoms();
if (lastAtom != XA_LAST_PREDEFINED)
AtomError();
commit 63a647abd51f44226cbd16aa04ebc57d07463c6d
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Thu May 13 03:44:12 2010 +0700
Fix code style: extra whitespace before ()
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/dix/atom.c b/dix/atom.c
index 6910dd5..02843d2 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -213,5 +213,5 @@ InitAtoms(void)
nodeTable[None] = (NodePtr)NULL;
MakePredeclaredAtoms();
if (lastAtom != XA_LAST_PREDEFINED)
- AtomError ();
+ AtomError();
}
commit 28211c443c693a1ca3db5740d0128274a3eef723
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Thu May 13 03:43:04 2010 +0700
Fix warning: it's safe to pass atom strings > XA_LAST_PREDEFINED to free(3)
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/dix/atom.c b/dix/atom.c
index ecfe4b0..6910dd5 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -180,8 +180,13 @@ FreeAtom(NodePtr patom)
FreeAtom(patom->left);
if(patom->right)
FreeAtom(patom->right);
- if (patom->a > XA_LAST_PREDEFINED)
- free(patom->string);
+ if (patom->a > XA_LAST_PREDEFINED) {
+ /*
+ * All strings above XA_LAST_PREDEFINED are strdup'ed, so it's safe to
+ * cast here
+ */
+ free((char *)patom->string);
+ }
free(patom);
}
commit 8b5326aa98eba201dd78aea3dd7114e1a084489b
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Wed May 12 20:27:02 2010 +0000
Mark OsAbort as noreturn function to make gcc happier.
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
diff --git a/include/os.h b/include/os.h
index 82d6694..d34e056 100644
--- a/include/os.h
+++ b/include/os.h
@@ -299,7 +299,7 @@ extern _X_EXPORT void OsBlockSignals (void);
extern _X_EXPORT void OsReleaseSignals (void);
-extern _X_EXPORT void OsAbort (void);
+extern _X_EXPORT void OsAbort (void) X_NORETURN;
#if !defined(WIN32)
extern _X_EXPORT int System(char *);
commit 868e372a73b377705217e0379bc6e00f36c4d8e5
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Thu May 13 01:59:06 2010 +0700
Introduce X_NORETURN macro defined as __attribute__((noreturn)) for gcc
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
diff --git a/include/misc.h b/include/misc.h
index c7add25..e4bdee4 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -106,6 +106,12 @@ typedef unsigned long ATOM;
#define X_DEPRECATED
#endif
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#define X_NORETURN __attribute__((noreturn))
+#else
+#define X_NORETURN
+#endif
+
#ifndef _XTYPEDEF_CALLBACKLISTPTR
typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
#define _XTYPEDEF_CALLBACKLISTPTR
diff --git a/include/os.h b/include/os.h
index 7f358ee..82d6694 100644
--- a/include/os.h
+++ b/include/os.h
@@ -547,10 +547,7 @@ extern _X_EXPORT void FreeAuditTimer(void);
extern _X_EXPORT void AuditF(const char *f, ...) _printf_attribute(1,2);
extern _X_EXPORT void VAuditF(const char *f, va_list args);
extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2)
-#if defined(__GNUC__) && (__GNUC__ > 2)
-__attribute((noreturn))
-#endif
-;
+ X_NORETURN;
#ifdef DEBUG
#define DebugF ErrorF
diff --git a/os/log.c b/os/log.c
index ff78545..0781659 100644
--- a/os/log.c
+++ b/os/log.c
@@ -402,9 +402,8 @@ LogMessage(MessageType type, const char *format, ...)
va_end(ap);
}
-#ifdef __GNUC__
-void AbortServer(void) __attribute__((noreturn));
-#endif
+void
+AbortServer(void) X_NORETURN;
void
AbortServer(void)
commit 5a8e2f2745ae1f74501cd3f42614a1ed2cf974f2
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Wed May 12 18:54:51 2010 +0000
Do not jump through the hoops to deallocate xkbbasedirflag variable
Fixes gcc warning as well.
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index a9b5ca9..b1d6294 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -186,7 +186,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
const char *emptystring = "";
- const char *xkbbasedirflag = emptystring;
+ char *xkbbasedirflag = NULL;
const char *xkbbindir = emptystring;
const char *xkbbindirsep = emptystring;
@@ -230,13 +230,11 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
xkbbindir, xkbbindirsep,
( (xkbDebugFlags < 2) ? 1 :
((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ),
- xkbbasedirflag, xkmfile,
+ xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
xkm_output_dir, keymap);
- if (xkbbasedirflag != emptystring) {
- free(xkbbasedirflag);
- }
+ free(xkbbasedirflag);
#ifndef WIN32
out= Popen(buf,"w");
commit ff2b4cf8329b1678adafcda02e5d47a072550d47
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Thu May 13 01:51:37 2010 +0700
Turn sprintf argument into literaral string, shutting up gcc warning
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
diff --git a/os/osinit.c b/os/osinit.c
index e8fcd45..32747df 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -161,7 +161,6 @@ void
OsInit(void)
{
static Bool been_here = FALSE;
- static char* admpath = ADMPATH;
static char* devnull = "/dev/null";
char fname[PATH_MAX];
@@ -229,8 +228,8 @@ OsInit(void)
{
FILE *err;
- if (strlen (display) + strlen (admpath) + 1 < sizeof fname)
- sprintf (fname, admpath, display);
+ if (strlen (display) + strlen (ADMPATH) + 1 < sizeof fname)
+ sprintf (fname, ADMPATH, display);
else
strcpy (fname, devnull);
/*
commit f62ba192c285b1e49bf299f03fc0b763680afaaf
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date: Thu May 13 01:47:26 2010 +0700
Do not use deprecated Xalloc function
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index 3c6ed4e..5a0e523 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -73,7 +73,7 @@ miPolyPoint(
int i;
xPoint *ppt;
- if(!(pwidthInit = xalloc(npt * sizeof(int))))
+ if(!(pwidthInit = malloc(npt * sizeof(int))))
return;
/* make pointlist origin relative */
commit 21ceae9002c6364deb3d074cf2da7d3864cf6879
Author: Jamey Sharp <jamey at minilop.net>
Date: Tue May 11 10:24:00 2010 -0700
SetFontPath: set client->errorValue on failure.
Previously the callers were only setting errorValue on Success, when
it's ignored, and leaving it alone on failure, when it's sent to the
client.
Since SetFontPath takes the ClientPtr, let it set client->errorValue
instead of letting the callers continue to get it wrong.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Julien Cristau <jcristau at debian.org>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 63c978c..4dc9ecd 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3406,7 +3406,6 @@ ProcSetFontPath(ClientPtr client)
unsigned long nbytes, total;
long nfonts;
int n, result;
- int error;
REQUEST(xSetFontPathReq);
REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
@@ -3424,13 +3423,9 @@ ProcSetFontPath(ClientPtr client)
}
if (total >= 4)
return(BadLength);
- result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
- &error);
+ result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
if (!result)
- {
result = client->noClientException;
- client->errorValue = error;
- }
return (result);
}
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index aaa992b..e145254 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1789,9 +1789,8 @@ bail:
return FontToXError(err);
}
-/* XXX -- do we need to pass error down to each renderer? */
int
-SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
+SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
{
int err = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
if (err != Success)
@@ -1801,7 +1800,9 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
if (SetDefaultFontPath(defaultFontPath) != Success)
return BadValue;
} else {
- err = SetFontPathElements(npaths, paths, error, FALSE);
+ int bad;
+ err = SetFontPathElements(npaths, paths, &bad, FALSE);
+ client->errorValue = bad;
}
return err;
}
diff --git a/hw/dmx/dmxfont.c b/hw/dmx/dmxfont.c
index 8e4a17e..b6b2e31 100644
--- a/hw/dmx/dmxfont.c
+++ b/hw/dmx/dmxfont.c
@@ -172,7 +172,6 @@ static int dmxProcSetFontPath(ClientPtr client)
unsigned long nbytes, total, n;
long nfonts;
int i, result;
- int error;
unsigned char *oldFontPath, *tmpFontPath;
int nOldPaths;
int lenOldPaths;
@@ -198,22 +197,19 @@ static int dmxProcSetFontPath(ClientPtr client)
oldFontPath = malloc(nOldPaths + lenOldPaths);
memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
- result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
- &error);
+ result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
if (!result) {
+ int error = 0;
for (i = 0; i < dmxNumScreens; i++)
if ((result = dmxCheckFontPath(&dmxScreens[i], &error)))
break;
if (result) {
- int ignoreresult, ignoreerror;
-
/* Restore old fontpath in the DMX server */
- ignoreresult = SetFontPath(client, nOldPaths, oldFontPath,
- &ignoreerror);
+ SetFontPath(client, nOldPaths, oldFontPath);
+ client->errorValue = error;
} else {
result = client->noClientException;
- client->errorValue = error;
}
}
@@ -315,7 +311,6 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
int newnpaths = 0;
int len = 0;
int j = 0;
- int error;
dmxLog(dmxError,
"These font paths will not be used because the "
@@ -361,8 +356,7 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
}
}
- if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp,
- &error)) {
+ if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp)) {
/* Note that this should never happen since all of the
* FPEs were previously valid. */
dmxLog(dmxError, "Cannot reset the default font path.\n");
diff --git a/include/dixfont.h b/include/dixfont.h
index e444a20..cf86f54 100644
--- a/include/dixfont.h
+++ b/include/dixfont.h
@@ -96,8 +96,7 @@ extern _X_EXPORT int ImageText(ClientPtr /*client*/,
extern _X_EXPORT int SetFontPath(ClientPtr /*client*/,
int /*npaths*/,
- unsigned char * /*paths*/,
- int * /*error*/);
+ unsigned char * /*paths*/);
extern _X_EXPORT int SetDefaultFontPath(char * /*path*/);
More information about the xorg-commit
mailing list