Alexandre Julliard : server: Avoid redundant open call when looking for an object type.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 9 10:46:48 CST 2016


Module: wine
Branch: master
Commit: eb6621081a6d0f094d58c30e6850f3e01c88402e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=eb6621081a6d0f094d58c30e6850f3e01c88402e

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Feb  9 20:21:23 2016 +0900

server: Avoid redundant open call when looking for an object type.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/directory.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/directory.c b/server/directory.c
index 312a845..67d8089 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -269,13 +269,13 @@ struct object_type *get_object_type( const struct unicode_str *name )
 {
     struct object_type *type;
 
-    if ((type = open_object_dir( dir_objtype, name, 0, &object_type_ops )))
-        return type;
-
-    if ((type = create_named_object_dir( dir_objtype, name, 0, &object_type_ops )))
+    if ((type = create_named_object_dir( dir_objtype, name, OBJ_OPENIF, &object_type_ops )))
     {
-        grab_object( type );
-        make_object_static( &type->obj );
+        if (get_error() != STATUS_OBJECT_NAME_EXISTS)
+        {
+            grab_object( type );
+            make_object_static( &type->obj );
+        }
         clear_error();
     }
     return type;




More information about the wine-cvs mailing list