[geany/geany] 41d771: Remove built in globbing support when generating tag files

Jiří Techet git-noreply at geany.org
Tue May 17 16:51:52 UTC 2022


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Tue, 17 May 2022 16:51:52 UTC
Commit:      41d771c205302dbe28a6f6f1b60efb9ff360268c
             https://github.com/geany/geany/commit/41d771c205302dbe28a6f6f1b60efb9ff360268c

Log Message:
-----------
Remove built in globbing support when generating tag files

We can rely on shell to expand wildcards for us and the current detection
of whether globbing should be enabled based on \" presence is questionable,
undocumented and probably unused.


Modified Paths:
--------------
    configure.ac
    meson.build
    src/tagmanager/tm_workspace.c

Modified: configure.ac
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -45,7 +45,7 @@ fi
 # autoscan start
 
 # Checks for header files.
-AC_CHECK_HEADERS([fcntl.h glob.h stdlib.h sys/time.h errno.h limits.h])
+AC_CHECK_HEADERS([fcntl.h stdlib.h sys/time.h errno.h limits.h])
 
 # Checks for dependencies needed by ctags
 AC_CHECK_HEADERS([dirent.h fnmatch.h direct.h io.h sys/dir.h])


Modified: meson.build
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -46,7 +46,6 @@ check_headers = [
 	'errno.h',
 	'fcntl.h',
 	'fnmatch.h',
-	'glob.h',
 	'inttypes.h',
 	'io.h',
 	'langinfo.h',


Modified: src/tagmanager/tm_workspace.c
69 lines changed, 5 insertions(+), 64 deletions(-)
===================================================================
@@ -24,9 +24,6 @@
 #include <sys/types.h>
 #include <string.h>
 #include <sys/stat.h>
-#ifdef HAVE_GLOB_H
-# include <glob.h>
-#endif
 #include <glib/gstdio.h>
 
 #include "tm_workspace.h"
@@ -443,73 +440,17 @@ static GList *lookup_includes(const gchar **includes, gint includes_count)
 	GList *includes_files = NULL;
 	GHashTable *table; /* used for deduping */
 	gint i;
-#ifdef HAVE_GLOB_H
-	glob_t globbuf;
-	size_t idx_glob;
-#endif
 
 	table = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
 
-#ifdef HAVE_GLOB_H
-	globbuf.gl_offs = 0;
-
-	if (includes[0][0] == '"')	/* leading \" char for glob matching */
-	{
-		for (i = 0; i < includes_count; i++)
-		{
-			size_t dirty_len = strlen(includes[i]);
-			gchar *clean_path;
-
-			if (dirty_len < 2)
-				continue;
-
-			clean_path = g_malloc(dirty_len - 1);
-
-			strncpy(clean_path, includes[i] + 1, dirty_len - 1);
-			clean_path[dirty_len - 2] = 0;
-
-#ifdef TM_DEBUG
-			g_message ("[o][%s]\n", clean_path);
-#endif
-			glob(clean_path, 0, NULL, &globbuf);
-
-#ifdef TM_DEBUG
-			g_message ("matches: %d\n", globbuf.gl_pathc);
-#endif
-
-			for (idx_glob = 0; idx_glob < globbuf.gl_pathc; idx_glob++)
-			{
-#ifdef TM_DEBUG
-				g_message (">>> %s\n", globbuf.gl_pathv[idx_glob]);
-#endif
-				if (!g_hash_table_lookup(table, globbuf.gl_pathv[idx_glob]))
-				{
-					gchar *file_name_copy = g_strdup(globbuf.gl_pathv[idx_glob]);
-
-					includes_files = g_list_prepend(includes_files, file_name_copy);
-					g_hash_table_insert(table, file_name_copy, file_name_copy);
-#ifdef TM_DEBUG
-					g_message ("Added ...\n");
-#endif
-				}
-			}
-			globfree(&globbuf);
-			g_free(clean_path);
-		}
-	}
-	else
-#endif /* HAVE_GLOB_H */
+	for (i = 0; i < includes_count; i++)
 	{
-		/* no glob support or globbing not wanted */
-		for (i = 0; i < includes_count; i++)
+		if (!g_hash_table_lookup(table, includes[i]))
 		{
-			if (!g_hash_table_lookup(table, includes[i]))
-			{
-				gchar* file_name_copy = g_strdup(includes[i]);
+			gchar* file_name_copy = g_strdup(includes[i]);
 
-				includes_files = g_list_prepend(includes_files, file_name_copy);
-				g_hash_table_insert(table, file_name_copy, file_name_copy);
-			}
+			includes_files = g_list_prepend(includes_files, file_name_copy);
+			g_hash_table_insert(table, file_name_copy, file_name_copy);
 		}
 	}
 



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