registrybackend: more style fixes

This is the never ending story
This commit is contained in:
Ignacio Casal Quinteiro 2016-01-26 12:21:48 +01:00
parent 1b5b0eff9a
commit a92d97ff1f

View File

@ -456,7 +456,7 @@ registry_cache_ref_tree (GNode *tree)
} }
static void static void
_free_cache_item (RegistryCacheItem *item) registry_cache_item_free (RegistryCacheItem *item)
{ {
trace ("\t -- Free node %s\n", item->name); trace ("\t -- Free node %s\n", item->name);
@ -477,7 +477,7 @@ _unref_node (GNode *node)
if (item->ref_count == 0) if (item->ref_count == 0)
{ {
_free_cache_item (item); registry_cache_item_free (item);
g_node_destroy (node); g_node_destroy (node);
} }
} }
@ -915,18 +915,18 @@ g_registry_backend_write_one (const char *key_name,
GRegistryBackend *self; GRegistryBackend *self;
RegistryWrite *action; RegistryWrite *action;
RegistryValue value; RegistryValue value;
HKEY hroot;
HKEY hroot, hpath; HKEY hpath;
gchar *path_name, *value_name = NULL; gchar *path_name;
gchar *value_name = NULL;
DWORD value_data_size; DWORD value_data_size;
LPVOID value_data; LPVOID value_data;
LONG result; LONG result;
GNode *node; GNode *node;
gboolean changed; gboolean changed;
const gchar *type_string;
const gchar *type_string = g_variant_get_type_string (variant); type_string = g_variant_get_type_string (variant);
action = user_data; action = user_data;
self = G_REGISTRY_BACKEND (action->self); self = G_REGISTRY_BACKEND (action->self);
hroot = action->hroot; hroot = action->hroot;
@ -1128,7 +1128,6 @@ g_registry_backend_reset (GSettingsBackend *backend,
g_free (path_name); g_free (path_name);
g_settings_backend_changed (backend, key_name, origin_tag); g_settings_backend_changed (backend, key_name, origin_tag);
} }
@ -1198,7 +1197,7 @@ registry_cache_destroy_tree (GNode *node,
g_atomic_int_inc (&self->watches_remaining); g_atomic_int_inc (&self->watches_remaining);
} }
} }
_free_cache_item (node->data); registry_cache_item_free (node->data);
g_node_destroy (node); g_node_destroy (node);
} }
@ -1317,7 +1316,8 @@ registry_cache_update (GRegistryBackend *self,
if (!registry_read (hpath, key_name, buffer, &value)) if (!registry_read (hpath, key_name, buffer, &value))
continue; continue;
trace ("\tgot value %s for %s, node %x\n", registry_value_dump (value), buffer, cache_child_node); trace ("\tgot value %s for %s, node %x\n",
registry_value_dump (value), buffer, cache_child_node);
if (cache_child_node == NULL) if (cache_child_node == NULL)
{ {
@ -1473,12 +1473,14 @@ watch_thread_handle_message (WatchThreadState *self)
g_ptr_array_add (self->handles, watch->hpath); g_ptr_array_add (self->handles, watch->hpath);
g_ptr_array_add (self->prefixes, watch->prefix); g_ptr_array_add (self->prefixes, watch->prefix);
g_ptr_array_add (self->cache_nodes, watch->cache_node); g_ptr_array_add (self->cache_nodes, watch->cache_node);
trace ("watch thread: new watch on %s, %i total\n", watch->prefix, trace ("watch thread: new watch on %s, %i total\n", watch->prefix,
self->events->len); self->events->len);
} }
else else
{ {
g_message_win32_error (result, "watch thread: could not watch %s", watch->prefix); g_message_win32_error (result, "watch thread: could not watch %s", watch->prefix);
CloseHandle (watch->event); CloseHandle (watch->event);
RegCloseKey (watch->hpath); RegCloseKey (watch->hpath);
g_free (watch->prefix); g_free (watch->prefix);
@ -1515,6 +1517,7 @@ watch_thread_handle_message (WatchThreadState *self)
trace ("watch thread: unsubscribe: freeing node %x, prefix %s, index %i\n", trace ("watch thread: unsubscribe: freeing node %x, prefix %s, index %i\n",
(guint)cache_node, self->message.watch.prefix, i); (guint)cache_node, self->message.watch.prefix, i);
if (cache_node != NULL) if (cache_node != NULL)
{ {
cache_item = cache_node->data; cache_item = cache_node->data;
@ -1588,13 +1591,14 @@ watch_thread_function (LPVOID parameter)
GNode *cache_node; GNode *cache_node;
RegistryCacheItem *cache_item; RegistryCacheItem *cache_item;
RegistryEvent *event; RegistryEvent *event;
gint notify_index;
/* One of our notifications has triggered. All we know is which one, and which key /* One of our notifications has triggered. All we know is which one, and which key
* this is for. We do most of the processing here, because we may as well. If the * this is for. We do most of the processing here, because we may as well. If the
* registry changes further while we are processing it doesn't matter - we will then * registry changes further while we are processing it doesn't matter - we will then
* receive another change notification from the OS anyway. * receive another change notification from the OS anyway.
*/ */
gint notify_index = result - WAIT_OBJECT_0; notify_index = result - WAIT_OBJECT_0;
hpath = g_ptr_array_index (self->handles, notify_index); hpath = g_ptr_array_index (self->handles, notify_index);
cond = g_ptr_array_index (self->events, notify_index); cond = g_ptr_array_index (self->events, notify_index);
prefix = g_ptr_array_index (self->prefixes, notify_index); prefix = g_ptr_array_index (self->prefixes, notify_index);
@ -1776,6 +1780,7 @@ watch_add_notify (GRegistryBackend *self,
#endif #endif
g_return_val_if_fail (watch != NULL, FALSE); g_return_val_if_fail (watch != NULL, FALSE);
trace ("watch_add_notify: prefix %s.\n", gsettings_prefix); trace ("watch_add_notify: prefix %s.\n", gsettings_prefix);
/* Duplicate tree into the cache in the main thread, before we add the notify: if we do it in the /* Duplicate tree into the cache in the main thread, before we add the notify: if we do it in the
@ -1953,7 +1958,7 @@ g_registry_backend_finalize (GObject *object)
item = self->cache_root->data; item = self->cache_root->data;
g_warn_if_fail (item->ref_count == 1); g_warn_if_fail (item->ref_count == 1);
_free_cache_item (item); registry_cache_item_free (item);
g_node_destroy (self->cache_root); g_node_destroy (self->cache_root);
if (self->watch != NULL) if (self->watch != NULL)