[geany/geany-plugins] 48356d: projectorganizer: Don't parse files bigger than 10MB

Jiří Techet git-noreply at xxxxx
Sat May 2 09:49:51 UTC 2015


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sat, 02 May 2015 09:49:51 UTC
Commit:      48356d0c6f97027cfae0e234f6a55a75b47ea8a3
             https://github.com/geany/geany-plugins/commit/48356d0c6f97027cfae0e234f6a55a75b47ea8a3

Log Message:
-----------
projectorganizer: Don't parse files bigger than 10MB

This is where parsing starts getting too expensive.

TODO: the use of utf8 filename is obviously wrong here but at the moment
utf8/localeness is broken in the whole plugin anyway. Fix later ;-)


Modified Paths:
--------------
    projectorganizer/src/prjorg-project.c

Modified: projectorganizer/src/prjorg-project.c
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -221,9 +221,13 @@ static gboolean match_basename(gconstpointer pft, gconstpointer user_data)
 static GeanyFiletype *filetypes_detect(const gchar *utf8_filename)
 {
 	guint i;
+	struct stat s;
 	gchar *base_filename;
 	GeanyFiletype *ft = NULL;
 
+	if (g_stat(utf8_filename, &s) != 0 || s.st_size > 10*1024*1024)
+		return filetypes[GEANY_FILETYPES_NONE];
+
 	/* to match against the basename of the file (because of Makefile*) */
 	base_filename = g_path_get_basename(utf8_filename);
 #ifdef G_OS_WIN32



--------------
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