forked from AuroraMiddleware/gtk
label: Remove a double if (needs_root) check
The code is clearer and shorter this way.
This commit is contained in:
parent
7a98e79d90
commit
b16157bc0d
@ -2224,8 +2224,7 @@ parse_uri_markup (GtkLabel *label,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GMarkupParseContext *context = NULL;
|
GMarkupParseContext *context = NULL;
|
||||||
const gchar *p, *end;
|
const char *p, *end;
|
||||||
gboolean needs_root = TRUE;
|
|
||||||
gsize length;
|
gsize length;
|
||||||
UriParserData pdata;
|
UriParserData pdata;
|
||||||
|
|
||||||
@ -2241,22 +2240,21 @@ parse_uri_markup (GtkLabel *label,
|
|||||||
while (p != end && xml_isspace (*p))
|
while (p != end && xml_isspace (*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (end - p >= 8 && strncmp (p, "<markup>", 8) == 0)
|
|
||||||
needs_root = FALSE;
|
|
||||||
|
|
||||||
context = g_markup_parse_context_new (&markup_parser, 0, &pdata, NULL);
|
context = g_markup_parse_context_new (&markup_parser, 0, &pdata, NULL);
|
||||||
|
|
||||||
if (needs_root)
|
if (end - p >= 8 && strncmp (p, "<markup>", 8) == 0)
|
||||||
|
{
|
||||||
|
if (!g_markup_parse_context_parse (context, str, length, error))
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (!g_markup_parse_context_parse (context, "<markup>", -1, error))
|
if (!g_markup_parse_context_parse (context, "<markup>", -1, error))
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
|
||||||
|
|
||||||
if (!g_markup_parse_context_parse (context, str, length, error))
|
if (!g_markup_parse_context_parse (context, str, length, error))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
if (needs_root)
|
|
||||||
{
|
|
||||||
if (!g_markup_parse_context_parse (context, "</markup>", -1, error))
|
if (!g_markup_parse_context_parse (context, "</markup>", -1, error))
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user