[PATCH 1/3] Remove worthless isupper/islower checks

Matt Turner mattst88 at gmail.com
Sun Oct 9 11:01:44 PDT 2011


Was toupper() *really* expensive when this was written? :)

Also, initialize action_type with toupper(), since the check immediately
following assumes that its value is uppercase.

Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
 src/Paned.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/Paned.c b/src/Paned.c
index aa925b6..2c4d476 100644
--- a/src/Paned.c
+++ b/src/Paned.c
@@ -1024,22 +1024,17 @@ HandleGrip(Widget grip, XtPointer junk, XtPointer callData)
     Direction direction = 0;
     Arg arglist[1];
 
-    action_type = *call_data->params[0];
+    action_type = toupper(*call_data->params[0]);
 
     if (call_data->num_params == 0                             ||
 	(action_type == 'C' && call_data->num_params != 1)      ||
 	(action_type != 'C' && call_data->num_params != 2))
       	XtError( "Paned GripAction has been passed incorrect parameters." );
 
-    if (islower(action_type)) action_type = toupper(action_type);
-
     loc = GetEventLocation(pw, (XEvent *) (call_data->event));
 
     if (action_type != 'C') {
-	if ( isupper(*call_data->params[1]) )
-	  direction = (Direction) *call_data->params[1];
-	else
-	  direction = (Direction) toupper(*call_data->params[1]);
+	direction = (Direction) toupper(*call_data->params[1]);
     }
 
     switch (action_type) {
-- 
1.7.3.4



More information about the xorg-devel mailing list