From: Daniel Carl Date: Thu, 14 Jun 2018 21:16:16 +0000 (+0200) Subject: Make function static. X-Git-Url: https://git.owens.tech/projects.html/projects.html/git?a=commitdiff_plain;h=f782ec14e244fcddb5be4eccf4c12fcaad6eba92;p=vimb.git Make function static. This is only use within main.c so we can make it static and leaf the vb_ prefix. --- diff --git a/src/main.c b/src/main.c index 7f9731d..c995eb3 100644 --- a/src/main.c +++ b/src/main.c @@ -53,6 +53,7 @@ static GtkWidget *create_window(Client *c); static gboolean input_clear(Client *c); static void input_print(Client *c, MessageType type, gboolean hide, const char *message); +static gboolean is_plausible_uri(const char *path); static void marks_clear(Client *c); static void mode_free(Mode *mode); static void on_textbuffer_changed(GtkTextBuffer *textbuffer, gpointer user_data); @@ -352,21 +353,6 @@ void vb_input_update_style(Client *c) } } -/** - * Tests if a path is likely intended to be an URI (given that it's not a file - * path or containing "://"). - */ -gboolean vb_plausible_uri(const char *path) { - if (strchr(path, ' ')) return FALSE; - if (strchr(path, '.')) return TRUE; - const char *i, *j; - if ((i = strstr(path, "localhost")) && - (i == path || i[-1] == '/' || i[-1] == '@') && - (i[9] == 0 || i[9] == '/' || i[9] == ':')) return TRUE; - return ((i = strchr(path, '[')) && (j = strchr(i, ':')) && strchr(j, ']')) - ? TRUE : FALSE; -} - /** * Load the a uri given in Arg. This function handles also shortcuts and local * file paths. @@ -397,7 +383,7 @@ gboolean vb_load_uri(Client *c, const Arg *arg) rp = realpath(path, NULL); uri = g_strconcat("file://", rp, NULL); free(rp); - } else if (!vb_plausible_uri(path)) { + } else if (!is_plausible_uri(path)) { /* use a shortcut if path contains spaces or doesn't contain typical * tokens ('.', [:] for IPv6 addresses, 'localhost') */ uri = shortcut_get_uri(c->config.shortcuts, path); @@ -872,6 +858,28 @@ static void input_print(Client *c, MessageType type, gboolean hide, } } +/** + * Tests if a path is likely intended to be an URI (given that it's not a file + * path or containing "://"). + */ +static gboolean is_plausible_uri(const char *path) +{ + const char *i, *j; + if (strchr(path, ' ')) { + return FALSE; + } + if (strchr(path, '.')) { + return TRUE; + } + if ((i = strstr(path, "localhost")) && + (i == path || i[-1] == '/' || i[-1] == '@') && + (i[9] == 0 || i[9] == '/' || i[9] == ':') + ) { + return TRUE; + } + return (i = strchr(path, '[')) && (j = strchr(i, ':')) && strchr(j, ']'); +} + /** * Reinitializes or clears the set page marks. */