{
gchar* dst;
GString* str;
- int len;
+ int len = 0;
if (!src)
return NULL;
break;
}
src++;
+ len++;
}
while (*src);
- dst = g_strdup (str->str);
- g_string_free (str, TRUE);
+ dst = g_string_free (str, FALSE);
/* We dont need .* in the end of url. Thats stupid */
- len = strlen (dst);
if (dst && dst[len-1] == '*' && dst[len-2] == '.')
{
dst[len-2] = '\0';
int pos = 0;
gchar *sig;
+ if (!patt)
+ return;
+
/* TODO: Play with optimization flags */
regex = g_regex_new (patt, G_REGEX_OPTIMIZE,
G_REGEX_MATCH_NOTEMPTY, &error);
gchar* format_patt;
gchar* opts;
- g_test_timer_start ();
data = g_strsplit (line, "$", -1);
- if (data && data[0] && data[1] && data[2])
+ if (!data || !data[0])
+ return NULL;
+
+ if (data[1] && data[2])
{
patt = g_strconcat (data[0], data[1], NULL);
opts = g_strdup_printf ("t=%s,r=%s,%s", type, patt, data[2]);
g_strfreev (data);
}
- else if (data && data[0] && data[1])
+ else if (data[1])
{
patt = data[0];
opts = g_strdup_printf ("t=%s,r=%s,%s", type, patt, data[1]);
if (line[0] == '[')
return NULL;
+ /* Skip garbage */
+ if (line[0] == ' ' || !line[0])
+ return NULL;
+
/* Got CSS block hider */
if (line[0] == '#' && line[1] == '#' )
{