From: Rémi Bernon rbernon@codeweavers.com
--- server/atom.c | 8 ++++---- server/class.c | 32 ++++++++++---------------------- server/object.h | 2 +- 3 files changed, 15 insertions(+), 27 deletions(-)
diff --git a/server/atom.c b/server/atom.c index f3b0d1abffb..41b2f48928d 100644 --- a/server/atom.c +++ b/server/atom.c @@ -350,15 +350,15 @@ atom_t find_atom( struct atom_table *table, const struct unicode_str *str ) }
/* increment the ref count of a global atom; used for window properties */ -int grab_atom( struct atom_table *table, atom_t atom ) +atom_t grab_atom( struct atom_table *table, atom_t atom ) { if (atom >= MIN_STR_ATOM) { struct atom_entry *entry = get_atom_entry( table, atom ); - if (entry) entry->count++; - return (entry != NULL); + if (!entry) return 0; + entry->count++; } - else return 1; + return atom; }
/* decrement the ref count of a global atom; used for window properties */ diff --git a/server/class.c b/server/class.c index 5ecf60044da..4e02b08bca4 100644 --- a/server/class.c +++ b/server/class.c @@ -165,35 +165,23 @@ DECL_HANDLER(create_class) struct window_class *class; struct unicode_str name = get_req_unicode_str(); struct atom_table *table = get_user_atom_table(); - atom_t atom, base_atom; + atom_t atom = req->atom, base_atom;
- if (name.len) + if (!atom && !(atom = add_atom( table, &name ))) return; + + if (req->name_offset && req->name_offset < name.len / sizeof(WCHAR)) { - atom = add_atom( table, &name ); - if (!atom) return; - if (req->name_offset && req->name_offset < name.len / sizeof(WCHAR)) - { - name.str += req->name_offset; - name.len -= req->name_offset * sizeof(WCHAR); - - base_atom = add_atom( table, &name ); - if (!base_atom) - { - release_atom( table, atom ); - return; - } - } - else + name.str += req->name_offset; + name.len -= req->name_offset * sizeof(WCHAR); + if (!(base_atom = add_atom( table, &name ))) { - base_atom = atom; - grab_atom( table, atom ); + release_atom( table, atom ); + return; } } else { - base_atom = atom = req->atom; - if (!grab_atom( table, atom )) return; - grab_atom( table, base_atom ); + base_atom = grab_atom( table, atom ); }
class = find_class( current->process, atom, req->instance ); diff --git a/server/object.h b/server/object.h index 1622e93f784..0e74b9ba9d7 100644 --- a/server/object.h +++ b/server/object.h @@ -296,7 +296,7 @@ extern struct atom_table *get_global_atom_table(void); extern struct atom_table *get_user_atom_table(void); extern atom_t add_atom( struct atom_table *table, const struct unicode_str *str ); extern atom_t find_atom( struct atom_table *table, const struct unicode_str *str ); -extern int grab_atom( struct atom_table *table, atom_t atom ); +extern atom_t grab_atom( struct atom_table *table, atom_t atom ); extern void release_atom( struct atom_table *table, atom_t atom );
/* directory functions */