[patch xdm 1/4] Remove #if 0'd code

Matthieu Herrb matthieu at herrb.eu
Wed Dec 2 03:22:21 PST 2015


Signed-off-by: Matthieu Herrb <matthieu at herrb.eu>
---
 chooser/chooser.c | 37 -------------------------
 include/dm.h      |  3 ---
 xdm/choose.c      | 11 --------
 xdm/dm.c          | 25 -----------------
 xdm/xdmcp.c       | 81 -------------------------------------------------------
 5 files changed, 157 deletions(-)

diff --git chooser/chooser.c chooser/chooser.c
index bbcf80c..6ebf2cc 100644
--- chooser/chooser.c
+++ chooser/chooser.c
@@ -406,28 +406,6 @@ DisposeHostname (HostName *host)
     free (host);
 }
 
-#if 0
-static void
-RemoveHostname (HostName *host)
-{
-    HostName	**prev, *hosts;
-
-    prev = &hostNamedb;
-    for (hosts = hostNamedb; hosts; hosts = hosts->next)
-    {
-	if (hosts == host)
-	    break;
-	prev = &hosts->next;
-    }
-    if (!hosts)
-	return;
-    *prev = host->next;
-    DisposeHostname (host);
-    NameTableSize--;
-    RebuildTable (NameTableSize);
-}
-#endif
-
 static void
 EmptyHostnames (void)
 {
@@ -674,21 +652,6 @@ RegisterHostname (char *name)
 
 static ARRAYofARRAY8	AuthenticationNames;
 
-#if 0
-static void
-RegisterAuthenticationName (char *name, int namelen)
-{
-    ARRAY8Ptr	authName;
-    if (!XdmcpReallocARRAYofARRAY8 (&AuthenticationNames,
-				    AuthenticationNames.length + 1))
-	return;
-    authName = &AuthenticationNames.data[AuthenticationNames.length-1];
-    if (!XdmcpAllocARRAY8 (authName, namelen))
-	return;
-    memmove( authName->data, name, namelen);
-}
-#endif
-
 static int
 InitXDMCP (char **argv)
 {
diff --git include/dm.h include/dm.h
index 4497f4e..13e7839 100644
--- include/dm.h
+++ include/dm.h
@@ -406,9 +406,6 @@ extern int NetaddrFamily (XdmcpNetaddr netaddrp);
 extern int addressEqual (XdmcpNetaddr a1, int len1, XdmcpNetaddr a2, int len2);
 
 /* in policy.c */
-# if 0
-extern ARRAY8Ptr Accept (/* struct sockaddr *from, int fromlen, CARD16 displayNumber */);
-# endif
 extern ARRAY8Ptr ChooseAuthentication (ARRAYofARRAY8Ptr authenticationNames);
 extern int CheckAuthentication (struct protoDisplay *pdpy, ARRAY8Ptr displayID, ARRAY8Ptr name, ARRAY8Ptr data);
 extern int SelectAuthorizationTypeIndex (ARRAY8Ptr authenticationName, ARRAYofARRAY8Ptr authorizationNames);
diff --git xdm/choose.c xdm/choose.c
index 1f769fe..2d9aabd 100644
--- xdm/choose.c
+++ xdm/choose.c
@@ -295,25 +295,14 @@ RegisterIndirectChoice (
 {
     ChoicePtr	c;
     int		insert;
-# if 0
-    int		found = 0;
-# endif
 
     Debug ("Got indirect choice back\n");
     for (c = choices; c; c = c->next) {
 	if (XdmcpARRAY8Equal (clientAddress, &c->client) &&
 	    connectionType == c->connectionType) {
-# if 0
-	    found = 1;
-# endif
 	    break;
 	}
     }
-# if 0
-    if (!found)
-	return 0;
-# endif
-
     insert = 0;
     if (!c)
     {
diff --git xdm/dm.c xdm/dm.c
index bdc830a..8a7aebc 100644
--- xdm/dm.c
+++ xdm/dm.c
@@ -1045,31 +1045,6 @@ RemovePid (void)
 		      _SysErrorMsg (errno));
 }
 
-#if 0
-void
-UnlockPidFile (void)
-{
-    if (lockPidFile)
-# ifdef F_SETLK
-    {
-	struct flock lock_data;
-	lock_data.l_type = F_UNLCK;
-	lock_data.l_whence = SEEK_SET;
-	lock_data.l_start = lock_data.l_len = 0;
-	(void) fcntl(pidFd, F_SETLK, &lock_data);
-    }
-# else
-#  ifdef F_ULOCK
-	lockf (pidFd, F_ULOCK, 0);
-#  else
-	flock (pidFd, LOCK_UN);
-#  endif
-# endif
-    close (pidFd);
-    fclose (pidFilePtr);
-}
-#endif
-
 #ifndef HAVE_SETPROCTITLE
 void SetTitle (char *name, ...)
 {
diff --git xdm/xdmcp.c xdm/xdmcp.c
index 14fb940..b56e588 100644
--- xdm/xdmcp.c
+++ xdm/xdmcp.c
@@ -1470,85 +1470,4 @@ NetworkAddressToHostname (
     return name;
 }
 
-# if 0
-static int
-HostnameToNetworkAddress (
-char	    *name,
-CARD16	    connectionType,
-ARRAY8Ptr   connectionAddress)
-{
-    switch (connectionType)
-    {
-    case FamilyInternet:
-	{
-	    struct hostent	*hostent;
-
-	    hostent = gethostbyname (name);
-	    if (!hostent)
-		return FALSE;
-	    if (!XdmcpAllocARRAY8 (connectionAddress, hostent->h_length))
-		return FALSE;
-	    memmove( connectionAddress->data, hostent->h_addr, hostent->h_length);
-	    return TRUE;
-	}
-    }
-    return FALSE;
-}
-
-/*
- * converts a display name into a network address, using
- * the same rules as XOpenDisplay (algorithm cribbed from there)
- */
-static int
-NameToNetworkAddress(
-char	    *name,
-CARD16Ptr   connectionTypep,
-ARRAY8Ptr   connectionAddress,
-CARD16Ptr   displayNumber)
-{
-    char    *colon, *display_number;
-    char    hostname[1024];
-    int	    dnet = FALSE;
-    CARD16  number;
-    CARD16  connectionType;
-
-    colon = strchr(name, ':');
-    if (!colon)
-	return FALSE;
-    if (colon != name)
-    {
-	if (colon - name > sizeof (hostname))
-	    return FALSE;
-	strncpy (hostname, name, colon - name);
-	hostname[colon - name] = '\0';
-    }
-    else
-    {
-	strcpy (hostname, localHostname ());
-    }
-    if (colon[1] == ':')
-    {
-	dnet = TRUE;
-	colon++;
-    }
-    if (dnet)
-	return FALSE;
-    display_number = colon + 1;
-    while (*display_number && *display_number != '.')
-    {
-	if (!isascii (*display_number) || !isdigit(*display_number))
-	    return FALSE;
-    }
-    if (display_number == colon + 1)
-	return FALSE;
-    number = atoi (colon + 1);
-    connectionType = FamilyInternet;
-    if (!HostnameToNetworkAddress (hostname, connectionType, connectionAddress))
-	return FALSE;
-    *displayNumber = number;
-    *connectionTypep = connectionType;
-    return TRUE;
-}
-# endif
-
 #endif /* XDMCP */
-- 
1.9.1



More information about the xorg-devel mailing list