markup: trivial refactor

Avoid an unnecessary branch.
This commit is contained in:
Matthias Clasen 2015-09-05 13:02:33 -04:00
parent d28639507d
commit 5644ee5083

View File

@ -657,7 +657,7 @@ unescape_gstring_inplace (GMarkupParseContext *context,
from++; from++;
if (*from == '#') if (*from == '#')
{ {
gboolean is_hex = FALSE; gint base = 10;
gulong l; gulong l;
gchar *end = NULL; gchar *end = NULL;
@ -665,16 +665,13 @@ unescape_gstring_inplace (GMarkupParseContext *context,
if (*from == 'x') if (*from == 'x')
{ {
is_hex = TRUE; base = 16;
from++; from++;
} }
/* digit is between start and p */ /* digit is between start and p */
errno = 0; errno = 0;
if (is_hex) l = strtoul (from, &end, base);
l = strtoul (from, &end, 16);
else
l = strtoul (from, &end, 10);
if (end == from || errno != 0) if (end == from || errno != 0)
{ {