[glib] markup: trivial refactor



commit 5644ee5083c5f03e01ee2e4de615c16cfc0dfcd0
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 5 13:02:33 2015 -0400

    markup: trivial refactor
    
    Avoid an unnecessary branch.

 glib/gmarkup.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/glib/gmarkup.c b/glib/gmarkup.c
index 4185ab3..bb24ec4 100644
--- a/glib/gmarkup.c
+++ b/glib/gmarkup.c
@@ -657,7 +657,7 @@ unescape_gstring_inplace (GMarkupParseContext  *context,
           from++;
           if (*from == '#')
             {
-              gboolean is_hex = FALSE;
+              gint base = 10;
               gulong l;
               gchar *end = NULL;
 
@@ -665,16 +665,13 @@ unescape_gstring_inplace (GMarkupParseContext  *context,
 
               if (*from == 'x')
                 {
-                  is_hex = TRUE;
+                  base = 16;
                   from++;
                 }
 
               /* digit is between start and p */
               errno = 0;
-              if (is_hex)
-                l = strtoul (from, &end, 16);
-              else
-                l = strtoul (from, &end, 10);
+              l = strtoul (from, &end, base);
 
               if (end == from || errno != 0)
                 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]