aboutsummaryrefslogtreecommitdiff
path: root/libX11
diff options
context:
space:
mode:
Diffstat (limited to 'libX11')
-rw-r--r--libX11/src/OpenDis.c20
-rw-r--r--libX11/src/Xxcbint.h2
-rw-r--r--libX11/src/xcb_disp.c18
3 files changed, 13 insertions, 27 deletions
diff --git a/libX11/src/OpenDis.c b/libX11/src/OpenDis.c
index 54729e8fd..0b779b0ad 100644
--- a/libX11/src/OpenDis.c
+++ b/libX11/src/OpenDis.c
@@ -69,7 +69,6 @@ XOpenDisplay (
int j, k; /* random iterator indexes */
char *display_name; /* pointer to display name */
char *setup = NULL; /* memory allocated at startup */
- char *fullname = NULL; /* expanded name of display */
int iscreen; /* screen number */
xConnSetupPrefix prefix; /* prefix information */
int vendorlen; /* length of vendor string */
@@ -117,13 +116,17 @@ XOpenDisplay (
return(NULL);
}
+ if ((dpy->display_name = strdup(display_name)) == NULL) {
+ OutOfMemory(dpy);
+ return(NULL);
+ }
+
/*
* Call the Connect routine to get the transport connection object.
- * If NULL is returned, the connection failed. The connect routine
- * will set fullname to point to the expanded name.
+ * If NULL is returned, the connection failed.
*/
- if(!_XConnectXCB(dpy, display, &fullname, &iscreen)) {
+ if(!_XConnectXCB(dpy, display, &iscreen)) {
/* Try falling back on other transports if no transport specified */
const char *slash = strrchr(display_name, '/');
if(slash == NULL) {
@@ -135,14 +138,13 @@ XOpenDisplay (
if(buf) {
for(s = protocols; buf && *s; s++) {
snprintf(buf, buf_size, "%s/%s", *s, display_name);
- if(_XConnectXCB(dpy, buf, &fullname, &iscreen))
+ if(_XConnectXCB(dpy, buf, &iscreen))
goto fallback_success;
}
Xfree(buf);
}
}
- dpy->display_name = fullname;
OutOfMemory(dpy);
return NULL;
}
@@ -152,7 +154,6 @@ fallback_success:
* Initialize pointers to NULL so that XFreeDisplayStructure will
* work if we run out of memory before we finish initializing.
*/
- dpy->display_name = fullname;
dpy->keysyms = (KeySym *) NULL;
dpy->modifiermap = NULL;
dpy->lock_meaning = NoSymbol;
@@ -314,7 +315,7 @@ fallback_success:
if (!mask)
{
fprintf (stderr, "Xlib: connection to \"%s\" invalid setup\n",
- fullname);
+ dpy->display_name);
OutOfMemory(dpy);
return (NULL);
}
@@ -678,8 +679,7 @@ void _XFreeDisplayStructure(Display *dpy)
Xfree ((char *)dpy->pixmap_format);
}
- if (dpy->display_name)
- Xfree (dpy->display_name);
+ free(dpy->display_name);
if (dpy->vendor)
Xfree (dpy->vendor);
diff --git a/libX11/src/Xxcbint.h b/libX11/src/Xxcbint.h
index 06636ce86..15423c407 100644
--- a/libX11/src/Xxcbint.h
+++ b/libX11/src/Xxcbint.h
@@ -40,7 +40,7 @@ typedef struct _X11XCBPrivate {
/* xcb_disp.c */
-int _XConnectXCB(Display *dpy, _Xconst char *display, char **fullnamep, int *screenp);
+int _XConnectXCB(Display *dpy, _Xconst char *display, int *screenp);
void _XFreeX11XCBStructure(Display *dpy);
#endif /* XXCBINT_H */
diff --git a/libX11/src/xcb_disp.c b/libX11/src/xcb_disp.c
index 2def9b014..60d186a5e 100644
--- a/libX11/src/xcb_disp.c
+++ b/libX11/src/xcb_disp.c
@@ -54,11 +54,10 @@ void XSetAuthorization(char *name, int namelen, char *data, int datalen)
_XUnlockMutex(_Xglobal_lock);
}
-int _XConnectXCB(Display *dpy, _Xconst char *display, char **fullnamep, int *screenp)
+int _XConnectXCB(Display *dpy, _Xconst char *display, int *screenp)
{
char *host;
int n = 0;
- int len;
xcb_connection_t *c;
dpy->fd = -1;
@@ -69,20 +68,7 @@ int _XConnectXCB(Display *dpy, _Xconst char *display, char **fullnamep, int *scr
if(!xcb_parse_display(display, &host, &n, screenp))
return 0;
-
- len = strlen(host) + (1 + 20 + 1 + 20 + 1);
- *fullnamep = Xmalloc(len);
- if (!*fullnamep) {
- free(host);
- return 0;
- }
-
-#ifdef HAVE_LAUNCHD
- if(strncmp(host, "/tmp/launch", 11) == 0)
- snprintf(*fullnamep, len, "%s:%d", host, n);
- else
-#endif
- snprintf(*fullnamep, len, "%s:%d.%d", host, n, *screenp);
+ /* host and n are unused, but xcb_parse_display requires them */
free(host);
_XLockMutex(_Xglobal_lock);