[PATCH:xf86-input-mouse 1/2] No need to merge NULL options list with existing options

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jul 25 22:15:13 PDT 2011


Appending NULL to an existing options list simply walks the entire
existing list before returning it unchanged, so if we aren't creating
a new list to merge, don't bother merging it either.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/mouse.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mouse.c b/src/mouse.c
index 238d7f7..d883b82 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -2431,13 +2431,13 @@ SetupMouse(InputInfoPtr pInfo)
      * for the new protocol.
      */
     if (pMse->oldProtocolID != pMse->protocolID) {
-	pointer tmp = NULL;
 	if ((pMse->protocolID >= 0)
 	    && (pMse->protocolID < PROT_NUMPROTOS)
-	    && mouseProtocols[pMse->protocolID].defaults)
-	    tmp = xf86OptionListCreate(
+	    && mouseProtocols[pMse->protocolID].defaults) {
+	    pointer tmp = xf86OptionListCreate(
 		mouseProtocols[pMse->protocolID].defaults, -1, 0);
-	pInfo->options = xf86OptionListMerge(pInfo->options, tmp);
+	    pInfo->options = xf86OptionListMerge(pInfo->options, tmp);
+	}
 	/*
 	 * If baudrate is set write it back to the option
 	 * list so that the serial interface code can access
-- 
1.7.3.2



More information about the xorg-devel mailing list