mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
inotify: Optimize consecutive g_hash_table_{lookup,remove} calls
This commit is contained in:
parent
697118dfd5
commit
30dfc99c94
@ -275,12 +275,10 @@ ik_source_dispatch (GSource *source,
|
|||||||
{
|
{
|
||||||
ik_event_t *pair;
|
ik_event_t *pair;
|
||||||
|
|
||||||
pair = g_hash_table_lookup (iks->unmatched_moves, GUINT_TO_POINTER (event->cookie));
|
if (g_hash_table_steal_extended (iks->unmatched_moves, GUINT_TO_POINTER (event->cookie), NULL, (gpointer*)&pair))
|
||||||
if (pair != NULL)
|
|
||||||
{
|
{
|
||||||
g_assert (!pair->pair);
|
g_assert (!pair->pair);
|
||||||
|
|
||||||
g_hash_table_remove (iks->unmatched_moves, GUINT_TO_POINTER (event->cookie));
|
|
||||||
event->is_second_in_pair = TRUE;
|
event->is_second_in_pair = TRUE;
|
||||||
event->pair = pair;
|
event->pair = pair;
|
||||||
pair->pair = event;
|
pair->pair = event;
|
||||||
@ -344,12 +342,10 @@ ik_source_dispatch (GSource *source,
|
|||||||
{
|
{
|
||||||
ik_event_t *pair;
|
ik_event_t *pair;
|
||||||
|
|
||||||
pair = g_hash_table_lookup (iks->unmatched_moves, GUINT_TO_POINTER (event->cookie));
|
if (g_hash_table_steal_extended (iks->unmatched_moves, GUINT_TO_POINTER (event->cookie), NULL, (gpointer*)&pair))
|
||||||
if (pair != NULL)
|
|
||||||
{
|
{
|
||||||
g_assert (!pair->pair);
|
g_assert (!pair->pair);
|
||||||
|
|
||||||
g_hash_table_remove (iks->unmatched_moves, GUINT_TO_POINTER (event->cookie));
|
|
||||||
event->is_second_in_pair = TRUE;
|
event->is_second_in_pair = TRUE;
|
||||||
event->pair = pair;
|
event->pair = pair;
|
||||||
pair->pair = event;
|
pair->pair = event;
|
||||||
|
Loading…
Reference in New Issue
Block a user