[geany/geany-plugins] 213b24: addons/tasks: Rework the detection loop

Quentin Glidic git-noreply at xxxxx
Fri Jun 17 12:49:10 UTC 2016


Branch:      refs/heads/master
Author:      Quentin Glidic <sardemff7+git at sardemff7.net>
Committer:   Quentin Glidic <sardemff7+git at sardemff7.net>
Date:        Fri, 17 Jun 2016 12:49:10 UTC
Commit:      213b24a2f0a0522f7db07a6b67a526b5ff6a346c
             https://github.com/geany/geany-plugins/commit/213b24a2f0a0522f7db07a6b67a526b5ff6a346c

Log Message:
-----------
addons/tasks: Rework the detection loop

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>


Modified Paths:
--------------
    addons/src/ao_tasks.c

Modified: addons/src/ao_tasks.c
34 lines changed, 17 insertions(+), 17 deletions(-)
===================================================================
@@ -570,24 +570,24 @@ static void update_tasks_for_doc(AoTasks *t, GeanyDocument *doc)
 		for (line = 0; line < lines; line++)
 		{
 			line_buf = g_strstrip(sci_get_line(doc->editor->sci, line));
-			token = priv->tokens;
-			while (*token != NULL)
+			for (token = priv->tokens; *token != NULL; ++token)
 			{
-				if (!EMPTY(*token) && (task_start = strstr(line_buf, *token)) != NULL)
-				{
-					/* skip the token and additional whitespace */
-					task_start += strlen(*token);
-					while (*task_start == ' ' || *task_start == ':')
-						task_start++;
-					/* reset task_start in case there is no text following */
-					if (EMPTY(task_start))
-						task_start = line_buf;
-					/* create the task */
-					create_task(t, doc, line, *token, line_buf, task_start, display_name);
-					/* if we found a token, continue on next line */
-					break;
-				}
-				token++;
+				if (EMPTY(*token))
+					continue;
+				if ((task_start = strstr(line_buf, *token)) == NULL)
+					continue;
+
+				/* skip the token and additional whitespace */
+				task_start += strlen(*token);
+				while (*task_start == ' ' || *task_start == ':')
+					task_start++;
+				/* reset task_start in case there is no text following */
+				if (EMPTY(task_start))
+					task_start = line_buf;
+				/* create the task */
+				create_task(t, doc, line, *token, line_buf, task_start, display_name);
+				/* if we found a token, continue on next line */
+				break;
 			}
 			g_free(line_buf);
 		}



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


More information about the Plugins-Commits mailing list