libmm-glib,helpers: skip quotes when reading numbers from match infos

Useful when the regex applied to the parseable strings don't have an
special ignore rule for the quotes.
This commit is contained in:
Aleksander Morgado
2020-03-24 06:17:34 +01:00
parent 44ace9642c
commit 539562af01

View File

@@ -1356,17 +1356,10 @@ mm_get_int_from_match_info (GMatchInfo *match_info,
guint32 match_index, guint32 match_index,
gint *out) gint *out)
{ {
gchar *s; g_autofree gchar *s = NULL;
gboolean ret;
s = g_match_info_fetch (match_info, match_index); s = mm_get_string_unquoted_from_match_info (match_info, match_index);
if (!s) return (s ? mm_get_int_from_str (s, out) : FALSE);
return FALSE;
ret = mm_get_int_from_str (s, out);
g_free (s);
return ret;
} }
gboolean gboolean
@@ -1492,17 +1485,10 @@ mm_get_u64_from_match_info (GMatchInfo *match_info,
guint32 match_index, guint32 match_index,
guint64 *out) guint64 *out)
{ {
gchar *s; g_autofree gchar *s = NULL;
gboolean ret;
s = g_match_info_fetch (match_info, match_index); s = mm_get_string_unquoted_from_match_info (match_info, match_index);
if (!s) return (s ? mm_get_u64_from_str (s, out) : FALSE);
return FALSE;
ret = mm_get_u64_from_str (s, out);
g_free (s);
return ret;
} }
gboolean gboolean
@@ -1549,17 +1535,10 @@ mm_get_double_from_match_info (GMatchInfo *match_info,
guint32 match_index, guint32 match_index,
gdouble *out) gdouble *out)
{ {
gchar *s; g_autofree gchar *s = NULL;
gboolean ret;
s = g_match_info_fetch (match_info, match_index); s = mm_get_string_unquoted_from_match_info (match_info, match_index);
if (!s) return (s ? mm_get_double_from_str (s, out) : FALSE);
return FALSE;
ret = mm_get_double_from_str (s, out);
g_free (s);
return ret;
} }
gchar * gchar *