Improve duplicate skipping logic in form history extension
This commit is contained in:
parent
3d972f11e4
commit
f759fe921a
1 changed files with 4 additions and 1 deletions
|
@ -166,16 +166,19 @@ formhistory_update_main_hash (gchar* key,
|
||||||
if ((tmp = g_hash_table_lookup (global_keys, (gpointer)key)))
|
if ((tmp = g_hash_table_lookup (global_keys, (gpointer)key)))
|
||||||
{
|
{
|
||||||
gchar* rvalue = g_strdup_printf ("\"%s\"",value);
|
gchar* rvalue = g_strdup_printf ("\"%s\"",value);
|
||||||
if (!g_regex_match_simple (rvalue, tmp,
|
gchar* patt = g_regex_escape_string (rvalue, -1);
|
||||||
|
if (!g_regex_match_simple (patt, tmp,
|
||||||
G_REGEX_CASELESS, G_REGEX_MATCH_NOTEMPTY))
|
G_REGEX_CASELESS, G_REGEX_MATCH_NOTEMPTY))
|
||||||
{
|
{
|
||||||
gchar* new_value = g_strdup_printf ("%s%s,", tmp, rvalue);
|
gchar* new_value = g_strdup_printf ("%s%s,", tmp, rvalue);
|
||||||
g_hash_table_insert (global_keys, g_strdup (key), new_value);
|
g_hash_table_insert (global_keys, g_strdup (key), new_value);
|
||||||
g_free (rvalue);
|
g_free (rvalue);
|
||||||
|
g_free (patt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_free (rvalue);
|
g_free (rvalue);
|
||||||
|
g_free (patt);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue