[gtksourceview] implregex: simplify fetch_named()



commit 3ed09076a1b751934b4ddd8faef085dbd2abe63f
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jul 2 14:30:14 2021 -0700

    implregex: simplify fetch_named()
    
    To make things a bit more like gregex.

 gtksourceview/implregex.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gtksourceview/implregex.c b/gtksourceview/implregex.c
index 273e8af7..178be00d 100644
--- a/gtksourceview/implregex.c
+++ b/gtksourceview/implregex.c
@@ -375,14 +375,11 @@ impl_match_info_fetch_named (const ImplMatchInfo *match_info,
 
        g_return_val_if_fail (match_info != NULL, NULL);
 
-       if (match_info->start_pos < match_info->string_len)
+       if (impl_match_info_fetch_named_pos (match_info, name, &begin, &end))
        {
-               if (impl_match_info_fetch_named_pos (match_info, name, &begin, &end))
+               if (begin >= 0 && end >= 0)
                {
-                       if (begin >= 0 && end >= 0)
-                       {
-                               return g_strndup (match_info->string + begin, end - begin);
-                       }
+                       return g_strndup (match_info->string + begin, end - begin);
                }
        }
 


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