diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-06-26 14:49:09 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-06-28 00:05:09 -0400 |
commit | d1a5fbff26079ab3271697a806a0aebaa5a75f03 (patch) | |
tree | 3dfe04644be945c528d4d211c0e788301fba35d1 /pango/pango-markup.c | |
parent | e028b8997775ddade1c4d94156b0b7c7262959a8 (diff) | |
download | pango-d1a5fbff26079ab3271697a806a0aebaa5a75f03.tar.gz |
markup: Save a few lines
pango_markup_parser_new_internal can't really fail.
Diffstat (limited to 'pango/pango-markup.c')
-rw-r--r-- | pango/pango-markup.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/pango/pango-markup.c b/pango/pango-markup.c index 258ca717..9721595d 100644 --- a/pango/pango-markup.c +++ b/pango/pango-markup.c @@ -584,17 +584,10 @@ pango_markup_parser_new_internal (char accel_marker, 0, md, (GDestroyNotify)destroy_markup_data); - if (!g_markup_parse_context_parse (context, - "<markup>", - -1, - error)) - goto error; + if (!g_markup_parse_context_parse (context, "<markup>", -1, error)) + g_clear_pointer (&context, g_markup_parse_context_free); return context; - - error: - g_markup_parse_context_free (context); - return NULL; } /** @@ -654,8 +647,6 @@ pango_parse_markup (const char *markup_text, context = pango_markup_parser_new_internal (accel_marker, error, (attr_list != NULL)); - if (context == NULL) - goto out; if (!g_markup_parse_context_parse (context, markup_text, @@ -711,16 +702,9 @@ pango_parse_markup (const char *markup_text, * Since: 1.31.0 **/ GMarkupParseContext * -pango_markup_parser_new (gunichar accel_marker) +pango_markup_parser_new (gunichar accel_marker) { - GError *error = NULL; - GMarkupParseContext *context; - context = pango_markup_parser_new_internal (accel_marker, &error, TRUE); - - if (context == NULL) - g_critical ("Had error when making markup parser: %s\n", error->message); - - return context; + return pango_markup_parser_new_internal (accel_marker, NULL, TRUE); } /** |