From b16157bc0db81c54d8817f4c8d85eedd8ec68c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 10 Apr 2020 16:23:32 +0200 Subject: [PATCH] label: Remove a double if (needs_root) check The code is clearer and shorter this way. --- gtk/gtklabel.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 62d297285c..5caf2ea1d0 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -2224,8 +2224,7 @@ parse_uri_markup (GtkLabel *label, GError **error) { GMarkupParseContext *context = NULL; - const gchar *p, *end; - gboolean needs_root = TRUE; + const char *p, *end; gsize length; UriParserData pdata; @@ -2241,22 +2240,21 @@ parse_uri_markup (GtkLabel *label, while (p != end && xml_isspace (*p)) p++; - if (end - p >= 8 && strncmp (p, "", 8) == 0) - needs_root = FALSE; - context = g_markup_parse_context_new (&markup_parser, 0, &pdata, NULL); - if (needs_root) + if (end - p >= 8 && strncmp (p, "", 8) == 0) + { + if (!g_markup_parse_context_parse (context, str, length, error)) + goto failed; + } + else { if (!g_markup_parse_context_parse (context, "", -1, error)) goto failed; - } - if (!g_markup_parse_context_parse (context, str, length, error)) - goto failed; + if (!g_markup_parse_context_parse (context, str, length, error)) + goto failed; - if (needs_root) - { if (!g_markup_parse_context_parse (context, "", -1, error)) goto failed; }