[geany/geany] df9a1b: fix regex error message parsing (GRegex indexes subgroups, not matches)

Dimitar Zhekov git-noreply at xxxxx
Thu Feb 13 23:08:15 UTC 2014


Branch:      refs/heads/master
Author:      Dimitar Zhekov <dimitar.zhekov at gmail.com>
Committer:   elextr <elextr at gmail.com>
Date:        Thu, 13 Feb 2014 23:08:15 UTC
Commit:      df9a1b15c60f91be2af558112dc201569b9863d2
             https://github.com/geany/geany/commit/df9a1b15c60f91be2af558112dc201569b9863d2

Log Message:
-----------
fix regex error message parsing (GRegex indexes subgroups, not matches)


Modified Paths:
--------------
    src/filetypes.c

Modified: src/filetypes.c
22 files changed, 19 insertions(+), 3 deletions(-)
===================================================================
@@ -1288,11 +1288,27 @@ gboolean filetypes_parse_error_message(GeanyFiletype *ft, const gchar *message,
 	}
 	if (g_match_info_get_match_count(minfo) >= 3)
 	{
-		gchar *first, *second, *end;
+		gchar *first = NULL, *second, *end;
 		glong l;
+		gint i;
+
+		for (i = 1; ; i++)
+		{
+			gint start_pos;
+
+			g_match_info_fetch_pos(minfo, i, &start_pos, NULL);
+			if (start_pos != -1)
+			{
+				if (first == NULL)
+					first = g_match_info_fetch(minfo, i);
+				else
+				{
+					second = g_match_info_fetch(minfo, i);
+					break;
+				}
+			}
+		}
 
-		first = g_match_info_fetch(minfo, 1);
-		second = g_match_info_fetch(minfo, 2);
 		l = strtol(first, &end, 10);
 		if (*end == '\0')	/* first is purely decimals */
 		{



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list