+static int gl_register_host (const char *host) /* {{{ */
+{
+ char **tmp;
+ size_t i;
+
+ if (host == NULL)
+ return (EINVAL);
+
+ for (i = 0; i < host_list_len; i++)
+ if (strcmp (host_list[i], host) == 0)
+ return (0);
+
+ tmp = realloc (host_list, sizeof (*host_list) * (host_list_len + 1));
+ if (tmp == NULL)
+ return (ENOMEM);
+ host_list = tmp;
+
+ host_list[host_list_len] = strdup (host);
+ if (host_list[host_list_len] == NULL)
+ return (ENOMEM);
+
+ host_list_len++;
+ return (0);
+} /* }}} int gl_register_host */
+
+static int gl_clear_hosts (void) /* {{{ */
+{
+ size_t i;
+
+ for (i = 0; i < host_list_len; i++)
+ free (host_list[i]);
+ free (host_list);
+
+ host_list = NULL;
+ host_list_len = 0;
+
+ return (0);
+} /* }}} int gl_clear_hosts */
+
+static int gl_compare_hosts (const void *v0, const void *v1) /* {{{ */
+{
+ return (strcmp (v0, v1));
+} /* }}} int gl_compare_hosts */
+