Fixed indentation of gm_url_regex_match function

This commit is contained in:
Jesse van den Kieboom 2005-10-11 09:46:05 +00:00
parent 84b9681f70
commit 9405aa19f1

View file

@ -203,41 +203,41 @@ gm_directory_remove_all(const gchar * path, gboolean remove_self) {
gint gint
gm_url_regex_match(const gchar *msg, int len, GArray *start, GArray *end) { gm_url_regex_match(const gchar *msg, int len, GArray *start, GArray *end) {
static gboolean inited = FALSE; static gboolean inited = FALSE;
regmatch_t matches[1]; regmatch_t matches[1];
gint ret = 0, num_matches = 0, offset = 0; gint ret = 0, num_matches = 0, offset = 0;
gchar *tmp; gchar *tmp;
gint s; gint s;
if (!inited) { if (!inited) {
memset (&url_regexp, 0, sizeof (regex_t)); memset(&url_regexp, 0, sizeof (regex_t));
regcomp (&url_regexp, URL_REGEXP, REG_EXTENDED); regcomp(&url_regexp, URL_REGEXP, REG_EXTENDED);
inited = TRUE; inited = TRUE;
} }
tmp = g_strndup(msg, len); tmp = g_strndup(msg, len);
while (!ret) { while (!ret) {
ret = regexec(&url_regexp, (char *)(tmp + offset), 1, matches, 0); ret = regexec(&url_regexp, (char *)(tmp + offset), 1, matches, 0);
if (ret == 0) { if (ret == 0) {
if (matches[0].rm_so > matches[0].rm_eo) { if (matches[0].rm_so > matches[0].rm_eo) {
break; break;
} }
num_matches++; num_matches++;
s = matches[0].rm_so + offset; s = matches[0].rm_so + offset;
offset = matches[0].rm_eo + offset; offset = matches[0].rm_eo + offset;
g_array_append_val(start, s); g_array_append_val(start, s);
g_array_append_val(end, offset); g_array_append_val(end, offset);
} }
} }
g_free(tmp); g_free(tmp);
return num_matches; return num_matches;
} }
void void