Fixed indentation of gm_url_regex_match function
This commit is contained in:
parent
84b9681f70
commit
9405aa19f1
|
@ -203,41 +203,41 @@ gm_directory_remove_all(const gchar * path, gboolean remove_self) {
|
|||
|
||||
gint
|
||||
gm_url_regex_match(const gchar *msg, int len, GArray *start, GArray *end) {
|
||||
static gboolean inited = FALSE;
|
||||
regmatch_t matches[1];
|
||||
gint ret = 0, num_matches = 0, offset = 0;
|
||||
gchar *tmp;
|
||||
gint s;
|
||||
static gboolean inited = FALSE;
|
||||
regmatch_t matches[1];
|
||||
gint ret = 0, num_matches = 0, offset = 0;
|
||||
gchar *tmp;
|
||||
gint s;
|
||||
|
||||
if (!inited) {
|
||||
memset (&url_regexp, 0, sizeof (regex_t));
|
||||
regcomp (&url_regexp, URL_REGEXP, REG_EXTENDED);
|
||||
inited = TRUE;
|
||||
}
|
||||
if (!inited) {
|
||||
memset(&url_regexp, 0, sizeof (regex_t));
|
||||
regcomp(&url_regexp, URL_REGEXP, REG_EXTENDED);
|
||||
inited = TRUE;
|
||||
}
|
||||
|
||||
tmp = g_strndup(msg, len);
|
||||
tmp = g_strndup(msg, len);
|
||||
|
||||
while (!ret) {
|
||||
ret = regexec(&url_regexp, (char *)(tmp + offset), 1, matches, 0);
|
||||
while (!ret) {
|
||||
ret = regexec(&url_regexp, (char *)(tmp + offset), 1, matches, 0);
|
||||
|
||||
if (ret == 0) {
|
||||
if (matches[0].rm_so > matches[0].rm_eo) {
|
||||
break;
|
||||
}
|
||||
|
||||
num_matches++;
|
||||
if (ret == 0) {
|
||||
if (matches[0].rm_so > matches[0].rm_eo) {
|
||||
break;
|
||||
}
|
||||
|
||||
s = matches[0].rm_so + offset;
|
||||
offset = matches[0].rm_eo + offset;
|
||||
|
||||
g_array_append_val(start, s);
|
||||
g_array_append_val(end, offset);
|
||||
}
|
||||
}
|
||||
num_matches++;
|
||||
|
||||
s = matches[0].rm_so + offset;
|
||||
offset = matches[0].rm_eo + offset;
|
||||
|
||||
g_array_append_val(start, s);
|
||||
g_array_append_val(end, offset);
|
||||
}
|
||||
}
|
||||
|
||||
g_free(tmp);
|
||||
g_free(tmp);
|
||||
|
||||
return num_matches;
|
||||
return num_matches;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Reference in New Issue