From 008f14f03f28694e17a76b3f778de4f22d3d6c4b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 29 Jan 2016 16:36:45 +0900 Subject: [PATCH] server: Directly return a structure in get_req_unicode_str(). Signed-off-by: Alexandre Julliard --- server/atom.c | 6 ++---- server/class.c | 6 ++---- server/completion.c | 3 +-- server/device.c | 3 +-- server/directory.c | 3 +-- server/event.c | 6 ++---- server/fd.c | 3 +-- server/mapping.c | 3 +-- server/mutex.c | 3 +-- server/process.c | 3 +-- server/registry.c | 6 ++---- server/request.h | 8 +++++--- server/semaphore.c | 3 +-- server/symlink.c | 3 +-- server/timer.c | 3 +-- server/window.c | 15 +++++---------- server/winstation.c | 13 ++++--------- 17 files changed, 32 insertions(+), 58 deletions(-) diff --git a/server/atom.c b/server/atom.c index 0ed4ed5ce42..18608d89502 100644 --- a/server/atom.c +++ b/server/atom.c @@ -382,12 +382,11 @@ void release_global_atom( struct winstation *winstation, atom_t atom ) /* add a global atom */ DECL_HANDLER(add_atom) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); struct atom_table *table = get_table( req->table, 1 ); if (table) { - get_req_unicode_str( &name ); reply->atom = add_atom( table, &name ); release_object( table ); } @@ -407,12 +406,11 @@ DECL_HANDLER(delete_atom) /* find a global atom */ DECL_HANDLER(find_atom) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); struct atom_table *table = get_table( req->table, 0 ); if (table) { - get_req_unicode_str( &name ); reply->atom = find_atom( table, &name ); release_object( table ); } diff --git a/server/class.c b/server/class.c index 0e402ba6314..cc6e52d9b11 100644 --- a/server/class.c +++ b/server/class.c @@ -150,10 +150,9 @@ client_ptr_t get_class_client_ptr( struct window_class *class ) DECL_HANDLER(create_class) { struct window_class *class; - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); atom_t atom; - get_req_unicode_str( &name ); if (name.len) { atom = add_global_atom( NULL, &name ); @@ -197,10 +196,9 @@ DECL_HANDLER(create_class) DECL_HANDLER(destroy_class) { struct window_class *class; - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); atom_t atom = req->atom; - get_req_unicode_str( &name ); if (name.len) atom = find_global_atom( NULL, &name ); if (!(class = find_class( current->process, atom, req->instance ))) diff --git a/server/completion.c b/server/completion.c index ac67dd387b5..ceebce10d8d 100644 --- a/server/completion.c +++ b/server/completion.c @@ -196,9 +196,8 @@ DECL_HANDLER(create_completion) /* open a completion */ DECL_HANDLER(open_completion) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &completion_ops, &name, req->attributes ); } diff --git a/server/device.c b/server/device.c index b35f2e7b686..2c640ec79bf 100644 --- a/server/device.c +++ b/server/device.c @@ -708,7 +708,7 @@ DECL_HANDLER(create_device_manager) DECL_HANDLER(create_device) { struct device *device; - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); struct device_manager *manager; struct directory *root = NULL; @@ -716,7 +716,6 @@ DECL_HANDLER(create_device) 0, &device_manager_ops ))) return; - get_req_unicode_str( &name ); if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) { release_object( manager ); diff --git a/server/directory.c b/server/directory.c index d932a0d8708..93fdc74def1 100644 --- a/server/directory.c +++ b/server/directory.c @@ -522,9 +522,8 @@ DECL_HANDLER(create_directory) /* open a directory object */ DECL_HANDLER(open_directory) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &directory_ops, &name, req->attributes ); } diff --git a/server/event.c b/server/event.c index 0f0899b913f..943bd5b8876 100644 --- a/server/event.c +++ b/server/event.c @@ -306,9 +306,8 @@ DECL_HANDLER(create_event) /* open a handle to an event */ DECL_HANDLER(open_event) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &event_ops, &name, req->attributes ); } @@ -378,9 +377,8 @@ DECL_HANDLER(create_keyed_event) /* open a handle to a keyed event */ DECL_HANDLER(open_keyed_event) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &keyed_event_ops, &name, req->attributes ); } diff --git a/server/fd.c b/server/fd.c index 559a73741a4..12c00a28e60 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2384,11 +2384,10 @@ DECL_HANDLER(flush) /* open a file object */ DECL_HANDLER(open_file_object) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); struct directory *root = NULL; struct object *obj, *result; - get_req_unicode_str( &name ); if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) { if (get_error() != STATUS_OBJECT_TYPE_MISMATCH) return; diff --git a/server/mapping.c b/server/mapping.c index cae46d03862..3c7293d0e30 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -687,9 +687,8 @@ DECL_HANDLER(create_mapping) /* open a handle to a mapping */ DECL_HANDLER(open_mapping) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &mapping_ops, &name, req->attributes ); } diff --git a/server/mutex.c b/server/mutex.c index 1adbf427efa..0d7ae031d19 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -233,9 +233,8 @@ DECL_HANDLER(create_mutex) /* open a handle to a mutex */ DECL_HANDLER(open_mutex) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &mutex_ops, &name, req->attributes ); } diff --git a/server/process.c b/server/process.c index 24faea5d120..40cbf938208 100644 --- a/server/process.c +++ b/server/process.c @@ -1561,9 +1561,8 @@ DECL_HANDLER(create_job) /* open a job object */ DECL_HANDLER(open_job) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &job_ops, &name, req->attributes ); } diff --git a/server/registry.c b/server/registry.c index a35765c72f4..a41f0addbfc 100644 --- a/server/registry.c +++ b/server/registry.c @@ -2142,12 +2142,11 @@ DECL_HANDLER(set_key_value) DECL_HANDLER(get_key_value) { struct key *key; - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); reply->total = 0; if ((key = get_hkey_obj( req->hkey, KEY_QUERY_VALUE ))) { - get_req_unicode_str( &name ); get_value( key, &name, &reply->type, &reply->total ); release_object( key ); } @@ -2169,11 +2168,10 @@ DECL_HANDLER(enum_key_value) DECL_HANDLER(delete_key_value) { struct key *key; - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); if ((key = get_hkey_obj( req->hkey, KEY_SET_VALUE ))) { - get_req_unicode_str( &name ); delete_value( key, &name ); release_object( key ); } diff --git a/server/request.h b/server/request.h index 857c53edfb3..e4d20e81408 100644 --- a/server/request.h +++ b/server/request.h @@ -77,10 +77,12 @@ static inline data_size_t get_req_data_size(void) } /* get the request vararg as unicode string */ -static inline void get_req_unicode_str( struct unicode_str *str ) +static inline struct unicode_str get_req_unicode_str(void) { - str->str = get_req_data(); - str->len = (get_req_data_size() / sizeof(WCHAR)) * sizeof(WCHAR); + struct unicode_str ret; + ret.str = get_req_data(); + ret.len = (get_req_data_size() / sizeof(WCHAR)) * sizeof(WCHAR); + return ret; } /* get the reply maximum vararg size */ diff --git a/server/semaphore.c b/server/semaphore.c index 993d2e373ff..7213effe403 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -201,9 +201,8 @@ DECL_HANDLER(create_semaphore) /* open a handle to a semaphore */ DECL_HANDLER(open_semaphore) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &semaphore_ops, &name, req->attributes ); } diff --git a/server/symlink.c b/server/symlink.c index 650c5105b02..2611dc30b88 100644 --- a/server/symlink.c +++ b/server/symlink.c @@ -189,9 +189,8 @@ DECL_HANDLER(create_symlink) /* open a symbolic link object */ DECL_HANDLER(open_symlink) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &symlink_ops, &name, req->attributes | OBJ_OPENLINK ); } diff --git a/server/timer.c b/server/timer.c index c492bd6a070..2b9cb79b202 100644 --- a/server/timer.c +++ b/server/timer.c @@ -251,9 +251,8 @@ DECL_HANDLER(create_timer) /* open a handle to a timer */ DECL_HANDLER(open_timer) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &timer_ops, &name, req->attributes ); } diff --git a/server/window.c b/server/window.c index 5f32f1e1907..93282115068 100644 --- a/server/window.c +++ b/server/window.c @@ -1884,7 +1884,7 @@ void destroy_window( struct window *win ) DECL_HANDLER(create_window) { struct window *win, *parent = NULL, *owner = NULL; - struct unicode_str cls_name; + struct unicode_str cls_name = get_req_unicode_str(); atom_t atom; reply->handle = 0; @@ -1904,7 +1904,6 @@ DECL_HANDLER(create_window) while (!is_desktop_window(owner->parent)) owner = owner->parent; } - get_req_unicode_str( &cls_name ); atom = cls_name.len ? find_global_atom( NULL, &cls_name ) : req->atom; if (!(win = create_window( parent, owner, atom, req->instance ))) return; @@ -2118,11 +2117,10 @@ DECL_HANDLER(get_window_children) unsigned int total; user_handle_t *data; data_size_t len; - struct unicode_str cls_name; + struct unicode_str cls_name = get_req_unicode_str(); atom_t atom = req->atom; struct desktop *desktop = NULL; - get_req_unicode_str( &cls_name ); if (cls_name.len && !(atom = find_global_atom( NULL, &cls_name ))) return; if (req->desktop) @@ -2673,12 +2671,11 @@ DECL_HANDLER(redraw_window) /* set a window property */ DECL_HANDLER(set_window_property) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); struct window *win = get_window( req->window ); if (!win) return; - get_req_unicode_str( &name ); if (name.len) { atom_t atom = add_global_atom( NULL, &name ); @@ -2695,10 +2692,9 @@ DECL_HANDLER(set_window_property) /* remove a window property */ DECL_HANDLER(remove_window_property) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); struct window *win = get_window( req->window ); - get_req_unicode_str( &name ); if (win) { atom_t atom = name.len ? find_global_atom( NULL, &name ) : req->atom; @@ -2710,10 +2706,9 @@ DECL_HANDLER(remove_window_property) /* get a window property */ DECL_HANDLER(get_window_property) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); struct window *win = get_window( req->window ); - get_req_unicode_str( &name ); if (win) { atom_t atom = name.len ? find_global_atom( NULL, &name ) : req->atom; diff --git a/server/winstation.c b/server/winstation.c index ac4506685f2..b1ebe3cdc84 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -401,11 +401,10 @@ void close_thread_desktop( struct thread *thread ) DECL_HANDLER(create_winstation) { struct winstation *winstation; - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); struct directory *root = NULL; reply->handle = 0; - get_req_unicode_str( &name ); if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) return; if ((winstation = create_winstation( root, &name, req->attributes, req->flags ))) @@ -419,9 +418,8 @@ DECL_HANDLER(create_winstation) /* open a handle to a window station */ DECL_HANDLER(open_winstation) { - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); - get_req_unicode_str( &name ); reply->handle = open_object( current->process, req->rootdir, req->access, &winstation_ops, &name, req->attributes ); } @@ -467,10 +465,9 @@ DECL_HANDLER(create_desktop) { struct desktop *desktop; struct winstation *winstation; - struct unicode_str name; + struct unicode_str name = get_req_unicode_str(); reply->handle = 0; - get_req_unicode_str( &name ); if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP ))) { if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation ))) @@ -487,9 +484,7 @@ DECL_HANDLER(open_desktop) { struct winstation *winstation; struct object *obj; - struct unicode_str name; - - get_req_unicode_str( &name ); + struct unicode_str name = get_req_unicode_str(); /* FIXME: check access rights */ if (!req->winsta)