s3: Tune if-conditions in a very hot codepath
authorVolker Lendecke <vl@samba.org>
Sun, 15 Nov 2009 21:22:38 +0000 (22:22 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 21 Nov 2009 11:15:39 +0000 (12:15 +0100)
This looks innocent, but it is visible in a netbench run.  Due to boolean
short-circuiting we don't have to execute the conditions on the right-hand side
of the &&. So putting the less likely condition left gains a bit.

source3/smbd/reply.c

index ae88db7..682f56f 100644 (file)
@@ -67,7 +67,7 @@ static NTSTATUS check_path_syntax_internal(char *path,
                        }
                }
 
-               if (!posix_path && !stream_started && *s == ':') {
+               if ((*s == ':') && !posix_path && !stream_started) {
                        if (*p_last_component_contains_wcard) {
                                return NT_STATUS_OBJECT_NAME_INVALID;
                        }