Skip to content

Commit

Permalink
open-uri: rename DomainHandler to UriHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
andyholmes committed Apr 9, 2024
1 parent eb95c16 commit 3be7a58
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/open-uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,16 +508,16 @@ typedef struct
GStrv hosts;
GStrv paths;
GStrv exclude_paths;
} DomainHandler;
} UriHandler;

static DomainHandler *
domain_handler_copy (DomainHandler *handler)
static UriHandler *
uri_handler_copy (UriHandler *handler)
{
return g_memdup2 (handler, sizeof (DomainHandler));
return g_memdup2 (handler, sizeof (UriHandler));
}

static void
domain_handler_free (DomainHandler *handler)
uri_handler_free (UriHandler *handler)
{
g_assert (handler != NULL);

Expand All @@ -529,16 +529,16 @@ domain_handler_free (DomainHandler *handler)
}

static gpointer
domain_handler_deserialize (JsonNode *node)
uri_handler_deserialize (JsonNode *node)
{
DomainHandler *ret = NULL;
UriHandler *ret = NULL;
JsonObjectIter iter;
const char *member;
JsonNode *value;

g_return_val_if_fail (JSON_NODE_HOLDS_OBJECT (node), NULL);

ret = g_new0 (DomainHandler, 1);
ret = g_new0 (UriHandler, 1);

json_object_iter_init (&iter, json_node_get_object (node));
while (json_object_iter_next (&iter, &member, &value))
Expand Down Expand Up @@ -566,25 +566,25 @@ domain_handler_deserialize (JsonNode *node)
}

static GType
domain_handler_get_type (void)
uri_handler_get_type (void)
{
static GType boxed_type = 0;

if (boxed_type == 0)
{
boxed_type =
g_boxed_type_register_static (g_intern_static_string ("DomainHandler"),
(GBoxedCopyFunc) domain_handler_copy,
(GBoxedFreeFunc) domain_handler_free);
g_boxed_type_register_static (g_intern_static_string ("UriHandler"),
(GBoxedCopyFunc) uri_handler_copy,
(GBoxedFreeFunc) uri_handler_free);
json_boxed_register_deserialize_func (boxed_type, JSON_NODE_OBJECT,
domain_handler_deserialize);
uri_handler_deserialize);
}

return boxed_type;
}

static gboolean
domain_handler_match (DomainHandler *handler,
uri_handler_match (UriHandler *handler,
GUri *uri)
{
const char *scheme = NULL;
Expand Down Expand Up @@ -668,7 +668,7 @@ app_handler_match (AppUriHandlers *app,

for (unsigned int i = 0; i < handlers->len; i++)
{
if (domain_handler_match (g_ptr_array_index (handlers, i), uri))
if (uri_handler_match (g_ptr_array_index (handlers, i), uri))
return TRUE;
}

Expand Down Expand Up @@ -709,11 +709,11 @@ load_handlers_json (void)
g_autoptr(GPtrArray) handlers = NULL;
g_autoptr(GList) apps = NULL;

handlers = g_ptr_array_new_with_free_func ((GDestroyNotify)domain_handler_free);
handlers = g_ptr_array_new_with_free_func ((GDestroyNotify)uri_handler_free);
apps = json_array_get_elements (json_node_get_array (app_handlers));
for (GList *iter = apps; iter != NULL; iter = iter->next)
{
gpointer *handler = json_boxed_deserialize (domain_handler_get_type (),
gpointer *handler = json_boxed_deserialize (uri_handler_get_type (),
iter->data);
if (handler != NULL)
g_ptr_array_add (handlers, g_steal_pointer (&handler));
Expand Down

0 comments on commit 3be7a58

Please sign in to comment.